原文: How to convert BitmapImage to WriteableBitmap in Universal application for windows 10?

您可以直接从文件将图像加载到WriteableBitmap对象。

var filePicker = new FileOpenPicker();
filePicker.FileTypeFilter.Add(".jpg");
var result = await filePicker.PickSingleFileAsync(); if (result != null)
{
using (IRandomAccessStream stream = await result.OpenAsync(FileAccessMode.Read))
{
BitmapDecoder decoder = await BitmapDecoder.CreateAsync(stream);
WriteableBitmap bmp = new WriteableBitmap((int)decoder.PixelWidth, (int)decoder.PixelHeight);
bmp.SetSource(stream); // show the image in the UI if you want.
MyImage.Source = bmp;
}
}
这样你可以使用WriteableBitmap,你可以使用WriteableBitmapEx库。

  

在UWP 将BitmapImage转换为 WriteableBitmap的更多相关文章

  1. win10 uwp 读取保存WriteableBitmap 、BitmapImage

    我们在UWP,经常使用的图片,数据结构就是 BitmapImage 和 WriteableBitmap.关于 BitmapImage 和 WriteableBitmap 区别,我就不在这里说.主要说的 ...

  2. WriteableBitmap/BitmapImage/MemoryStream/byte[]相互转换

    1 WriteableBitmap/BitmapImage/MemoryStream/byte[]相互转换 2012-12-18 17:27:04|  分类: Windows Phone 8|字号 订 ...

  3. 【WPF】WriteableBitmap和BitmapImage的相互转换

    public BitmapImage ConvertWriteableBitmapToBitmapImage(WriteableBitmap wbm) { BitmapImage bmImage = ...

  4. 【转】【WPF】WriteableBitmap应用及图片数据格式转换

    使用 WriteableBitmap 类基于每个框架来更新和呈现位图.这对于生成算法内容(如分形图像)和数据可视化(如音乐可视化工具)很有用. WriteableBitmap 类使用两个缓冲区.“后台 ...

  5. 13、在 uwp应用中,给图片添加高斯模糊滤镜效果(一)

    如果在应用中,如果想要给app 添加模糊滤镜,可能第一想到的是第三方类库,比如 Win2d.lumia Imaging SDK .WriteableBitmapEx,不可否认,这些类库功能强大,效果也 ...

  6. WPF Image控件 Source: Byte[] ,BitmapImage 相互转换

    文件转为byte[] FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read); byte[] desBytes ...

  7. WriteableBitmap(一)

    通常,WPF中的位图是不可变的.不可变的位图非常有效,如果您希望进行大量的动态更改,创建和销毁它们的开销会变得非常昂贵.在这种情况下,您需要一些更灵活的东西——WriteableBitmap. Wri ...

  8. 2018-8-10-win10-uwp-读取保存WriteableBitmap-、BitmapImage

    title author date CreateTime categories win10 uwp 读取保存WriteableBitmap .BitmapImage lindexi 2018-08-1 ...

  9. windows rt 扫描二维码

    项目中使用的是ZXing.net,应用商店程序.使用到的dll是ZXing.winmd. 大致思路为,使用MediaCapture捕获图片.获取到CapturePhotoToStreamAsync流, ...

随机推荐

  1. amazeui中css组件、js组件、web组件的区别

    amazeui中css组件.js组件.web组件的区别 一.总结 一句话总结: 1.可直接像调用js插件那样调用:在AmazeUI(妹子UI)中,Web组件可以不编写模板而直接使用,若如此,则与JS插 ...

  2. 创建数据库以及其属性的sql语句

    创建数据库的SQL语句: create database stuDB on primary -- 默认就属于primary文件组,可省略 ( /*--数据文件的详细描写叙述--*/ name='stu ...

  3. matlab 运行 AlexNet

    0. alexnet 工具箱下载 下载地址:Neural Network Toolbox(TM) Model for AlexNet Network 需要先注册(十分简单),登陆,下载: 下载完成之后 ...

  4. 网站多语言转换.利用Google 语言的js.贴到网站就能用.

    <div id="google_translate_element"></div><script>function googleTranslat ...

  5. SpringBoot使用jsp作为视图模板&常规部署

    springboot其实并不推荐使用jsp作为视图模板,其默认采用Thymeleaf作为模板,出于对其没有研究,故考虑目前阶段仍然使用jsp作为视图模板.下面就展开实践案例过程: 1.首先创建一个js ...

  6. 【26.09%】【codeforces 579C】A Problem about Polyline

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  7. 【records】10.24..10.30

    做的题越来越少了; 我是不是该学下网络流.

  8. Video processing systems and methods

    BACKGROUND The present invention relates to video processing systems. Advances in imaging technology ...

  9. jquery大事-resize()办法

    为了形成用于电流大小的缩放对象构造监控事件. JQuery提供resize大事.在每一个匹配元素的resize函数到事件绑定,让我们适应窗口大小.对齐等.,档窗体改变大小时触发 这里有两种监听方式,一 ...

  10. 多线程编程 CreateThread(解释了TContext)

    function CreateThread( lpThreadAttributes: Pointer;           {安全设置} dwStackSize: DWORD;             ...