您的位置:首页 > 编程语言 > C#

[C#] - image与byte数组的转换

2010-03-24 11:07 483 查看
来源: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)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: