// 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数组的转换
图片转换为字节流
最新推荐文章于 2020-07-16 20:13:39 发布
本文介绍了一种将图片文件转换成字节流的方法,并演示了如何使用C#语言实现这一过程。具体步骤包括:加载图片到Bitmap对象,将Bitmap保存为JPEG格式的字节流,再从字节流中还原出图片。
7560

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



