C# .NET - Image to to Stream of Byte[]? - Asked By Majid Bhutta on 28-Nov-05 04:08 AM

Hi Dears!
I have an image in the pictureBox captured from a device.Now  i want to convert this PicBox.Image to stream of bytes to save it in the DataBase.Please help me how to convert this image from pictureBox to stream of bytes.I pretty know how to save it in database but having some problem converting the image to stream of bytes from PictureBox.
Thnx in Advance!

You can try something like this - Asked By Jon Wojtowicz on 28-Nov-05 05:56 AM

byte[] bytes;
using(MemoryStream ms = new MemeoryStream())
PictureBox1.Image.Save(ms, ImageFormat.Jpeg);
bytes = ms.ToArray();