BitmapImage to byte[] Windows 8 metro (WinRT)(BitmapImage 到字节 [] Windows 8 Metro (WinRT))
问题描述
我想在 Windows 8 应用程序中将 BitmapImage
转换为 byte[].我知道如何使用 windows sdk 来做到这一点,但似乎无法让它适用于 WinRT sdk.
I want to convert BitmapImage
to byte[] in windows 8 application. I know how to do it using windows sdk but can't seem to get it working for WinRT sdk.
一两篇文章建议我应该使用 WritableBitmap
来实现这一点,但没有明确的例子.
One or two posts are suggesting that I should use WritableBitmap
to achieve that but there are no clear examples.
BitmapImage 到字节数组的转换 (Windows)
以下是我发现的最好的,但对我来说仍然太模糊
following is the best I found but still too vague for me
WinRT 将图像加载到字节数组中
我将不胜感激.
推荐答案
你应该看看这里的 WriteableBitmapEx 项目 - http://writeablebitmapex.codeplex.com/ 这里讨论 - WinRT 将图像加载到字节数组中...来自答案...
You should look at the WriteableBitmapEx project here - http://writeablebitmapex.codeplex.com/ It is discussed here - WinRT Loading an Image into a Byte array... from the answer...
基本上你需要将图像加载到 WriteableBitmap 中,然后通过调用 PixelBuffer.AsStream() 访问其像素缓冲区.
Basically you need to load the image into a WriteableBitmap, then access its pixel buffer by calling PixelBuffer.AsStream().
这篇关于BitmapImage 到字节 [] Windows 8 Metro (WinRT)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:BitmapImage 到字节 [] Windows 8 Metro (WinRT)


基础教程推荐
- rabbitmq 的 REST API 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- MS Visual Studio .NET 的替代品 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- 如何激活MC67中的红灯 2022-01-01