Home All Groups Group Topic Archive Search About

Create jpg from byte array of raw image data

Author
21 Feb 2006 8:36 PM
Cynthia
I have a byte array of 24-bit image data. I want to compress the data as jpg
and write it to a stream. Is there any easy and fast way to do this in C#?

byte[] rawImageData = new byte[width*height *3];
// imagedata is filled with rgb pixel info

byte[] jpgImageData = ??? // compressed rawImageData (with header)

myStream.Write(jpgImageData);

Author
22 Feb 2006 5:37 AM
Li-fan Chen
Hi Cynthia,

Solution:
http://www.glennjones.net/Post/799/Highqualitydynamicallyresizedimageswithnet.htm

Do exactly as Glenn prescribes, but don't resize.

Best regards,
-- Li-fan
Show quote
"Cynthia" <Cynt***@discussions.microsoft.com> wrote in message
news:4446F441-68AE-479B-A11F-41949322E422@microsoft.com...
> I have a byte array of 24-bit image data. I want to compress the data as
jpg
> and write it to a stream. Is there any easy and fast way to do this in C#?
>
> byte[] rawImageData = new byte[width*height *3];
> // imagedata is filled with rgb pixel info
>
> byte[] jpgImageData = ??? // compressed rawImageData (with header)
>
> myStream.Write(jpgImageData);
>
>

AddThis Social Bookmark Button