如何将图像转换成字节数组
如何将图像转换成字节数组
这个问题已经在这里有了答案:
有人能建议我如何将图像转换为字节数组,反之亦然吗?
我正在开发一个WPF应用程序,并使用一个流阅读器。
admin 更改状态以发布 2023年5月23日
将图像转换为字节数组的示例代码
public byte[] ImageToByteArray(System.Drawing.Image imageIn) { using (var ms = new MemoryStream()) { imageIn.Save(ms,imageIn.RawFormat); return ms.ToArray(); } }