//图片转成二进制 public byte[] getBytes(string filePath) { System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Open); byte[] imgData = new byte[fs.Length]; fs.Read(imgData, 0, (int)fs.Length); return imgData; } //二进制转成图片 private System.Drawing.Image convertByteToImg(byte[] imgData) { System.IO.MemoryStream ms = new System.IO.MemoryStream(imgData); System.Drawing.Image img = System.Drawing.Image.FromStream(ms); return img; }
图片与二进制文件的互转
最新推荐文章于 2021-02-13 07:49:31 发布