[英]Convert PNG to JPG Windows Phone
i have a PNG file and i would convert into JPG The PNG is a large size(high resolution) (for example 30/40MB) 我有一个PNG文件,我将转换为JPG PNG是大尺寸(高分辨率)(例如30 / 40MB)
if i use this code receive a memory leak 如果我使用此代码会收到内存泄漏
using (var fileStream = myIsolatedStorage.OpenFile("1.png",FileMode.Open,FileAccess.Read))
{
WriteableBitmap wb = PictureDecoder.DecodeJpeg(fileStream);
}
How to? 如何? Thanks 谢谢
Your code cannot work since you loaded a png file, but the method beneath accepts jpeg stream. 由于您加载了png文件,因此您的代码无法正常工作,但是下面的方法接受jpeg流。 You can do the following> 您可以执行以下操作>
OpenFile
使用OpenFile
打开png文件 BitmapImage
将文件加载到BitmapImage
WriteableBitmap
from that BitmapImage
从该BitmapImage
创建一个WriteableBitmap
WriteableBitmap
as a jpeg file using the SaveJpeg extension method. 使用SaveJpeg扩展方法将创建的WriteableBitmap
保存为jpeg文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.