C#怎么把网络图片转化为Byte[]

2025-04-25 20:24:44
推荐回答(1个)
回答1:

public static byte[] GetBytesByImagePath(string strFile)
{
byte[] photo_byte = null;
using (FileStream fs =
new FileStream(strFile, FileMode.Open, FileAccess.Read))
{
using (BinaryReader br = new BinaryReader(fs))
{
photo_byte = br.ReadBytes((int)fs.Length);
}
}

return photo_byte;
}
strFile为转化文件