【发布时间】:2011-10-14 07:33:00
【问题描述】:
我使用以下内容将 jpgImage 写入 PictureBox.Image。
var jpgImage = new Byte[jpgImageSize];
...
pictureBox.Image = new Bitmap(new MemoryStream(jpgImage));
我可以使用以下内容将字节数组写入文件
using (var bw =
new BinaryWriter(File.Open(filename, FileMode.Create,
FileAccess.Write, FileShare.None)))
{
bw.Write(jpgImage);
}
但是如何从 PictureBox.Image 中获取 jpgImage 字节数组,以便将其写入文件? IOW:如何反转以下内容以从 PictureBox.Image 中获取字节数组?
pictureBox.Image = new Bitmap(new MemoryStream(jpgImage));
【问题讨论】:
标签: c# bitmap picturebox