将 ImageSource 转换为 BitmapImage - WPF [英] Convert ImageSource to BitmapImage - WPF

查看:53
本文介绍了将 ImageSource 转换为 BitmapImage - WPF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个类库来生成一个大的 ImageSource,> 3000x3750 像素.我想将此 ImageSource 转换为 BitmapImage,以便我可以利用 DecodePixelWidth 或 DecodePixelHeight 而不是每次生成此图像时都调整它的大小.

I'm using a class library that generates a large ImageSource, > 3000x3750 pixels. I would like to convert this ImageSource to BitmapImage so that I can take advantage of DecodePixelWidth or DecodePixelHeight instead of resizing it everytime this image is generated.

我需要先为用户显示这个图像,大多数用户的屏幕分辨率为 1024x768,为此我将这个 ImageSource 绑定到一个 Image 控件,但可以注意到它是多么重".

I need to display this image for the user first, and most of the users have a screen resolution of 1024x768, I'm binding this ImageSource to an Image control for this, but it can be noticed how "heavy" it is.

我该怎么做?或者这种情况的最佳解决方案是什么?

How can I do this? Or what is the best solution for this case?

谢谢!

推荐答案

我知道这是一个旧帖子,但尝试这样做:

I know it's a old post, but try doing:

myBitmapImage = myImageSource as BitmapImage;

效果很好.

这篇关于将 ImageSource 转换为 BitmapImage - WPF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆