打开图像文件到WritableBitmap [英] Opening an image file into WritableBitmap
问题描述
下面是问题所在。
我想打开本地硬盘的文件,然后把它变成一个WritableBitmap这样我就可以对其进行编辑。
但问题是,我无法从URI的WritableBitmap或类似的东西。此外,我知道如何打开一个文件到BitmapImage的,但我无法弄清楚如何打开一个文件WritableBitmap。
是没有办法直接打开一个文件到WritableBitmap,如果没有,有没有办法到BitmapImage的转换为WritableBitmap?
谢谢你们
Here is the problem. I want to open a file from local drives, then make it into a WritableBitmap so i can edit it. But the problem is, i cannot create a WritableBitmap from Uri or something like that. Also i know how to open a file into BitmapImage but i cannot figure out how to open a file as WritableBitmap. Is there way to open a file directly into a WritableBitmap,if there is not, is there a way to convert a BitmapImage to a WritableBitmap? Thanks guys.
推荐答案
您可以将您的图像文件加载到的 BitmapImage的,并使用它作为您的 WriteableBitmap的:
You can load your image file into a BitmapImage and use that as a source for your WriteableBitmap:
BitmapImage bitmap = new BitmapImage(new Uri("YourImage.jpg", UriKind.Relative));
WriteableBitmap writeableBitmap = new WriteableBitmap(bitmap);
这篇关于打开图像文件到WritableBitmap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!