在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流, ...
随机推荐
- uitableview顶部多出20距离, UIScollView顶部多出64距离
self.automaticallyAdjustsScrollViewInsets = NO;看 这个UIViewController的这个属性你就明白了,此属性默认为YES,这样UIViewCont ...
- 【codeforces 776D】The Door Problem
[题目链接]:http://codeforces.com/contest/776/problem/D [题意] 每个门严格由两个开关控制; 按一下开关,这个开关所控制的门都会改变状态; 问你能不能使所 ...
- Swift 中的Closures(闭包)详解
Swift 中的Closures(闭包)详解 在Swift没有发布之前,所有人使用OC语言编写Cocoa上的程序,而其中经常被人们讨论的其中之一 -- Block 一直备受大家的喜爱.在Swift中, ...
- No USB devices or running emulators detected”
每次重装系统之后,安装andorid studio后,使用真机调试代码,就会出现"No USB devices or running emulators detected"的错误, ...
- Matlab Tricks(三十) —— 任意区间的均匀分布
matlab 的内置函数 rand返回的是 0-1 区间上的均匀分布,rand的参数多是用于设置返回的矩阵的维度大小. 如果要得到 (a, b) 区间上的均匀分布,只需对其做简单的线性变换即可: a+ ...
- sql数据库恢复神器--Log Explorer 4.2使用教程
对于程序员来说,世界最悲催的事情是什么?——就是手贱,把数据库的数据给删掉了,更悲催的是木有任何数据库备份 感谢万能的度娘,感谢无私奉献的网友们,最感谢强大的LogExplorer工具 . 使用Lo ...
- android 创建一个新的每次project什么时候 请问自己主动 参加 V7依赖?
android 创建一个新的每次project什么时候 请问自己主动 参加 V7依赖? 分析原因: 主要是由于.我之前的 SDK 的版本号 更新的有点高了.低版本号是不会有这样的问题g的,新版本号中g ...
- onload 事件
定义和用法 onload 事件会在页面或图像加载完成后立即发生. 语法 onload="SomeJavaScriptCode" 参数 描述 SomeJavaScriptCode 必 ...
- Android官方教程翻译(5)——设置ActionBar
Setting Up the Action Bar 设置Action Bar PREVIOUSNEXT THIS LESSONTEACHES YOU TO 这节课教你 1. Support An ...
- 系统性能指标之 vmstat
系统性能指标 top top - 19:59:04 up 219 days, 21:51, 2 users, load average: 0.06, 0.06, 0.05 Tasks: 84 tota ...