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

发布于 2024-07-29 13:13:10 字数 205 浏览 4 评论 0原文

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

我有一个字节数组,其中包含 TIFF 图像文件的准确且完整的文件内容。 我需要将其显示在屏幕上,但我不知道从哪里开始。

据说,这是可以做到的(据我老板说,我们的开发团队过去曾经做到过,但没有人记得是如何做到的)。

这里有人曾经做过类似的事情吗?

How do I create a System.Windows.Media.ImageSource from a byte array?

I have a byte array, containing the exact and complete file contents of a TIFF image file. I need to display this on the screen, and I have no idea where to even start.

Supposedly, it can be done (according to my boss, our dev team has done it in the past, but nobody remembers how).

Has anyone here ever done something like this before?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

毅然前行 2024-08-05 13:13:10
BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.StreamSource = new MemoryStream(ByteArray);
bi.EndInit();

另请参阅 从 System.Drawing.Bitmap 加载 WPF BitmapImage< /a> 和 使用 WPF 中的 Image 控件显示系统.绘图.位图

BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.StreamSource = new MemoryStream(ByteArray);
bi.EndInit();

Also see Load a WPF BitmapImage from a System.Drawing.Bitmap and Using Image control in WPF to display System.Drawing.Bitmap

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文