BitmapImage 到字节 [] Windows 8 Metro (WinRT) [英] BitmapImage to byte[] Windows 8 metro (WinRT)

查看:17
本文介绍了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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆