Hello,
Thanks for your post. I believe the following code snippet is helpful:
//----------------Image to byte[] and byte[] to Image code------------------
public static byte[] ToByteArray(Image image)
{
// create a memory stream
MemoryStream stream = new MemoryStream();
// save the image into the memory stream
image.Save(stream, ImageFormat.Jpeg);
// return the stream buffer
return stream.GetBuffer();
}
public static Image ToImage(byte[] buffer)
{
// load the buffer into a memory stream
MemoryStream stream = new MemoryStream(buffer);
// load the image from the stream and return it
return new Bitmap(stream);
}
//--------------------end of-----------------------
Hope this helps.
Regards,
HuangTM
Microsoft Online Partner Support
MCSE/MCSD
Get Secure! --
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.