如何将WriteableBitmap转换为jpg或其他一些常见格式?

时间:2011-01-13 17:44:40

标签: silverlight-4.0 writeablebitmap

我有一个应用程序允许用户执行各种操作,如旋转和缩放图像,最后当用户点击保存时,图像应保存在服务器上。一切都很好,但问题是因为我使用WriteableBitmapEx将其转换为bytearray后直接保存了WriteableBitmap,保存的图像也是WriteableBitmap,所以我无法使用普通的图片查看器查看它。

我希望我的图片保存为JPEG格式。我怎么能这样做?

1 个答案:

答案 0 :(得分:3)

Hey Ankit,这是John Papa的一个示例,展示了如何将WriteableBitmaps保存到PNG。

http://johnpapa.net/silverlight/saving-snapshots-to-png-in-silverlight-4-and-the-webcam/

他使用两个选项:http://imagetools.codeplex.com/

并且:http://blogs.msdn.com/b/jstegman/archive/2008/04/21/dynamic-image-generation-in-silverlight.aspx

我建议使用ImageTools路线。