标签:
Image imgwd = this.imageList1.Images["wd.png"]; var bytes = ImageToBytes(imgwd);
public byte[] ImageToBytes(Image image) { using (MemoryStream ms = new MemoryStream()) { image.Save(ms, ImageFormat.Png); byte[] buffer = new byte[ms.Length]; ms.Seek(0, SeekOrigin.Begin); ms.Read(buffer, 0, buffer.Length); return buffer; } }
获得的bytes就是需要的byte数组。
标签:
原文地址:http://www.cnblogs.com/zhangyuanbo12358/p/4685978.html