| New Reply |
c# .bmp to .jpg |
Share Thread | Thread Tools |
| Feb2-12, 11:20 AM | #1 |
|
|
c# .bmp to .jpg
I am getting a 640x480 bitmap image of an Xbox Kinect, and I have also made a separate programs which can send and receive images over TCP.
Since bimaps are uncompressed I would like to convert the image to a JPEG to save bandwith. The only examples I have seen of this were for saving images. The code I have seen was something like this. Code:
Image bitmapImage = openfile(path); //Gets image from a file path Image jpegImage; jpegImage.save(path, jpg); //Saves a jpeg to the path Anyone got any ideas on how to do this? |
| Feb9-12, 04:06 AM | #2 |
|
|
Bump
Anyone got any ideas, I'm struggling to find a way to do this. |
| Feb9-12, 12:55 PM | #3 |
|
Mentor
|
What language are you coding in? That would be helpful information.
|
| Feb9-12, 01:10 PM | #4 |
Recognitions:
|
c# .bmp to .jpg |
| Feb9-12, 01:47 PM | #5 |
|
Admin
|
GDI+ comes to mind: http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
At least I used it to save plots of titration curves in PNG format (from C++) from my pH calculator. From what I remember it saves in JPG as well. |
| Feb9-12, 01:56 PM | #6 |
|
Mentor
|
Mad Mike, check the System.Drawing namespace, and particularly the Image class. The Save method has an overload that lets you specify the format of the saved image. |
| Feb10-12, 06:21 AM | #7 |
|
|
Yea, I'm using c#. Should have made that clear.
At the moment I am reading in a bmp image from the kinect camera, saving it as a jpg and then opening that file and sending the jpg. I would rather just be able to convert it with out having to save it to disk first. |
| Feb10-12, 08:16 PM | #8 |
|
Mentor
|
You don't have to save it to disk - you can save the bitmap image to a stream, and then do whatever with it. See http://msdn.microsoft.com/en-us/library/ms142147.aspx.
|
| New Reply |
| Thread Tools | |