C# 把byte[]输出为图片文件

时间:2022-07-15 19:21:32

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/HK_JY/article/details/80320381
/// <summary>
/// 将byte[]输出为图片
/// </summary>
/// <param name="path">输出图片的路径及名称</param>
/// <param name="picByte">byte[]数组存放的图片数据</param>
public void Write(string path,byte[] picByte)
{
FileStream fs = new FileStream(path, FileMode.Create);
BinaryWriter bw = new BinaryWriter(fs);
//开始写入
bw.Write(picByte, 0, picByte.Length);
//关闭流
bw.Close();
fs.Close();
}
调用:

string path = @"F:\testpic.jpg";

Write(path,picByte);
---------------------
作者:灬Change
来源:CSDN
原文:https://blog.csdn.net/HK_JY/article/details/80320381
版权声明:本文为博主原创文章,转载请附上博文链接!