一个原始二进制文件,一个正常图片文件,利用C#语言,前者该如何转为后者?
数据源链接(免费下载):https://download.csdn.net/download/Dust_Evc/16675902
百度Yun链接:https://pan.baidu.com/s/1Ae5oAo4t7nyOIAEGZbBXnQ
提取码:9958
在尝试了网上介绍的方法后还是失败(主体如下代码),故恳请各位大佬帮助!
FileStream ReadStream = new FileStream(openFile.FileName, FileMode.Open, FileAccess.Read);
byte[] data = new byte[ReadStream.Length];
ReadStream.Read(data, 0, data.Length);
// 将读取的数据转为图片
MemoryStream bs = new MemoryStream(data);
pictureBox1.Image = Image.FromStream(bs);
或者:pictureBox1.Image = new Bitmap(bs);
ReadStream.Close();
WriteStream.Close();
另外,此题在论坛发帖的讨论见该链接:https://bbs.csdn.net/topics/399167838?page=1 ,可供参考。
已解决,见博文:https://blog.csdn.net/Dust_Evc/article/details/115798626