在UWP 将BitmapImage转换为 WriteableBitmap
原文: 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的更多相关文章
- win10 uwp 读取保存WriteableBitmap 、BitmapImage
我们在UWP,经常使用的图片,数据结构就是 BitmapImage 和 WriteableBitmap.关于 BitmapImage 和 WriteableBitmap 区别,我就不在这里说.主要说的 ...
- WriteableBitmap/BitmapImage/MemoryStream/byte[]相互转换
1 WriteableBitmap/BitmapImage/MemoryStream/byte[]相互转换 2012-12-18 17:27:04| 分类: Windows Phone 8|字号 订 ...
- 【WPF】WriteableBitmap和BitmapImage的相互转换
public BitmapImage ConvertWriteableBitmapToBitmapImage(WriteableBitmap wbm) { BitmapImage bmImage = ...
- 【转】【WPF】WriteableBitmap应用及图片数据格式转换
使用 WriteableBitmap 类基于每个框架来更新和呈现位图.这对于生成算法内容(如分形图像)和数据可视化(如音乐可视化工具)很有用. WriteableBitmap 类使用两个缓冲区.“后台 ...
- 13、在 uwp应用中,给图片添加高斯模糊滤镜效果(一)
如果在应用中,如果想要给app 添加模糊滤镜,可能第一想到的是第三方类库,比如 Win2d.lumia Imaging SDK .WriteableBitmapEx,不可否认,这些类库功能强大,效果也 ...
- WPF Image控件 Source: Byte[] ,BitmapImage 相互转换
文件转为byte[] FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read); byte[] desBytes ...
- WriteableBitmap(一)
通常,WPF中的位图是不可变的.不可变的位图非常有效,如果您希望进行大量的动态更改,创建和销毁它们的开销会变得非常昂贵.在这种情况下,您需要一些更灵活的东西——WriteableBitmap. Wri ...
- 2018-8-10-win10-uwp-读取保存WriteableBitmap-、BitmapImage
title author date CreateTime categories win10 uwp 读取保存WriteableBitmap .BitmapImage lindexi 2018-08-1 ...
- windows rt 扫描二维码
项目中使用的是ZXing.net,应用商店程序.使用到的dll是ZXing.winmd. 大致思路为,使用MediaCapture捕获图片.获取到CapturePhotoToStreamAsync流, ...
随机推荐
- 【dotnet跨平台】Asp.net 正在经历的变革
[dotnet跨平台]Asp.net 正在经历的变革 Asp.net 正在经历一场变革.从官网:https://get.asp.net/ 我们能够看到多个版本号的字眼例如以下: ASP.NET ...
- VC++中用API调用对话框资源
关键技术: 对于资源的载入须要几个API函数,以下分别介绍这几个API函数. a) FindResource 用来在一个指定的模块中定位所指的资源,语法例如以下: HRSRC FindResource ...
- php课程 6-22 字符串格式化函数有哪些(精问)
php课程 6-22 字符串格式化函数有哪些(精问) 一.总结 一句话总结: 1.猜测一下$_GET()怎么来的? 函数赋值给变量的操作:$_YZM=get(); 这样就可以很好的解释哪些全局变量 ...
- jQuery+ localStorage 实现一个简易的计时器
原型 图片发自简书App 需求1.关闭浏览器时时间继续运行2.刷新时保持当前状态3.结束时间保存在客户端 <div class="wrapper"> <div c ...
- 【BZOJ 1007】 [HNOI2008]水平可见直线
[题目链接]:http://www.lydsy.com/JudgeOnline/problem.php?id=1007 [题意] [题解] 这个人讲得很好 http://blog.csdn.net/o ...
- 选择性编译代码:如 #ifdef __IPHONE_7_0
选择性编译代码: 选择性编译代码和选择性运行代码是不一样的,区别在于: 1.选择性编译代码是在硬件或者系统不支持的情况下不会对该段代码进行编译,也就不会由于不兼容的问题导致报错 #import < ...
- database disk image is malformed解决方法
作者:朱金灿 来源:http://blog.csdn.net/clever101 在Hudson上终止一次Job的运行之后,Hudson在服务器上更新源码出现下图的错误: 查了下英文意思,大意是svn ...
- 保护SSD,设置Chrome浏览器临时文件夹到ramdisk分区
很多用低端/山寨SSD的朋友都用Ramdisk来保护硬盘,一般都把系统temp目录和IE浏览器临时文件夹目录设到Ramdisk分区了. 最近用谷歌的chrome浏览器,发现浏览网页时候硬盘灯 ...
- node assert模块 Study.1
1.assert() 大体理解意思:assert可以抽象理解为node中的alert++ assert模块是Node的内置模块,用于断言的作用,如果不是自己想要的就抛出错误 assert(arg1, ...
- DOM渲染
浏览器通常要求DOM 实现和JavaScript 实现保持相互独立.例如,在Internet Explorer 中,被称为JScript的JavaScript 实现位于库文件jscript.dll 中 ...