[C#] - image与byte数组的转换
来源:http://hi.baidu.com/donghaozheng/blog/item/91bf0c08fd60f4d463d9863b.html
// image to byte[] Image photo = new Bitmap(selectPictureFile); System.IO.MemoryStream ms = new System.IO.MemoryStream(); photo.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] imagedata = ms.GetBuffer(); // byte[] to image System.IO.MemoryStream ms = New IO.MemoryStream(imagedata) Bitmap b = new Bitmap(ms); //img = Drawing.Image.FromStream(ms)
个性签名:做要做好,做到不三不四不如不做。