本文介绍了成的BitmapSource流的Windows Phone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这需要一个流,从手机摄像头旋转图像的类。我的问题是,加载从独立存储照片时(即后用户以前保存的图片)被加载到的BitmapSource。

I have a class which requires a Stream to rotate an image from the phone camera. The problem I have is that when loading the picture from isolated storage (ie after the user has saved the picture previously) it is loaded into a BitmapSource.

我想提取的位图源回如果可能的话流?没有人知道它是否使用Silverlight的WP7?

I would like to 'extract' the bitmap source back into a stream if possible? does anyone know if it is using silverlight for WP7?

感谢

推荐答案

试试这个:

WriteableBitmap bmp = new WriteableBitmap((BitmapSource)img);

using (MemoryStream stream = new MemoryStream()) {

    bmp.SaveJpeg(stream, bmp.PixelWidth, bmp.PixelHeight, 0, 100);
    return stream;
}

这篇关于成的BitmapSource流的Windows Phone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 16:52