BitmapImage转换为字节[] Windows 8 Metro(WinRT) [英] BitmapImage to byte[] Windows 8 metro (WinRT)

查看:51
本文介绍了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/在此处进行讨论-

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天全站免登陆