C# Converting Bitmap Image to JPEG for Xbox Kinect

  • Thread starter Thread starter madmike159
  • Start date Start date
  • Tags Tags
    Image
AI Thread Summary
The discussion centers around converting a 640x480 bitmap image from an Xbox Kinect into a JPEG format to save bandwidth during transmission over TCP. The user has successfully implemented image capture from the Kinect but seeks a method to convert the image to JPEG without saving it to disk first. Suggestions include using the System.Drawing namespace in C#, specifically the Image class, which allows for saving images in different formats. It is highlighted that instead of saving to disk, the bitmap can be converted and saved directly to a memory stream, facilitating more efficient image handling. The conversation emphasizes the importance of using appropriate methods for image conversion in C#.
madmike159
Gold Member
Messages
369
Reaction score
0
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

I want to be able to get an image from the Kinect (I have code for this bit), then that the Image object and save it to another Image but as a JPEG.

Anyone got any ideas on how to do this?
 
Technology news on Phys.org
Bump

Anyone got any ideas, I'm struggling to find a way to do this.
 
What language are you coding in? That would be helpful information.
 
Mark44 said:
What language are you coding in?

From the thread title, I presume C#.
 
AlephZero said:
From the thread title, I presume C#.
I thought he had said C#, but couldn't find it in the body of his post. Guess I didn't look hard enough to notice it in the title.

Mad Mike, check the System.Drawing namespace, and particularly the Image class. The Save method has an overload that let's you specify the format of the saved image.
 
Last edited:
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 without having to save it to disk first.
 

Similar threads

Back
Top