如何从字节数组创建System.Windows.Media.ImageSource?

Gif*_*guy 3 wpf tiff bytearray imagesource .net-3.5

如何从字节数组创建System.Windows.Media.ImageSource?

我有一个字节数组,包含TIFF图像文件的完整和完整的文件内容.我需要在屏幕上显示这个,我不知道从哪里开始.

据说,它可以完成(根据我的老板,我们的开发团队过去曾做过,但没有人记得如何).

以前有没有人做过这样的事情?

Lar*_*ens 13

BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.StreamSource = new MemoryStream(ByteArray);
bi.EndInit();
Run Code Online (Sandbox Code Playgroud)

另请参阅从System.Drawing.Bitmap加载WPF BitmapImage在WPF中使用Image控件来显示System.Drawing.Bitmap