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)
image与byte数组的转换
最新推荐文章于 2023-07-23 13:51:47 发布
本文介绍了如何将图片转换为byte数组以及如何将byte数组还原为图片的过程。使用了System.IO.MemoryStream和Bitmap类实现这一功能。对于需要在网络上传输图片的应用场景非常有用。
1668

被折叠的 条评论
为什么被折叠?



