如何转换为CroppedBitmap的BitmapImage [英] How to convert a CroppedBitmap to BitmapImage
问题描述
我试图将CroppedBitmap转换为BitmapImage * EDIT:不使用记忆库。
I am trying to convert a CroppedBitmap to BitmapImage * Without using a memorystream.*
我试图直接转换,似乎不是一个选择。
I have tried to directly convert it, seems that is not an option. This should't be that hard.
我试图剪下BitmapImage的一部分,并创建一个只包含新裁剪的Bitmap的BitmapImage。
I am attempting to cut out part of a BitmapImage, and create a BitmapImage that contains only the new cropped Bitmap.
推荐答案
看起来BitmapImage是一个专门版本的BitmapSource(这是一个CroppedBitmap是)。你可以轻松地从图像转换为源,但不是反过来。
It would seem a BitmapImage is a specialized version of BitmapSource (which is what a CroppedBitmap is). You can easily convert from Image to source, but not the otherway around.
这个答案可能有效,但我从来没有看过。
This answer likely works, though I never looked into it.
对我来说最简单的解决方案是将所有BitmapImages转换为BitmapSources。我甚至没有编辑任何其他代码。我想我没有使用专门的部分。
The easiest solution for me was to convert all my BitmapImages into BitmapSources. I didn't even have to edit any other code. I guess I wasn't using the specialized parts.
这篇关于如何转换为CroppedBitmap的BitmapImage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!