在Windows应用商店中保存图像 [英] Save image in Windows store apps
本文介绍了在Windows应用商店中保存图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一个Windows应用程序,我正在使用FileOpenPicker选择图像并使用API编辑图像,我在新的图像控件上显示已编辑的图像。如何将此图像保存到磁盘?
Hi, I''m working on a windows store application, I''m selecting an image using FileOpenPicker and editing the image using an API, I''m displaying the edited image on a new image control. How do i save this image to the disk?
推荐答案
Hello Ravindra,
要从PhotoChooserTask将图像保存到IsolatedStorage,请使用此(任务回调中的e对象保存流。
Hello Ravindra,
To save an image to IsolatedStorage from a PhotoChooserTask, use this (the e object in the task callback holds the stream.
public static void SaveImage(Stream imageStream, string fileName, int orientation, int quality)
{
using (var isolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
if (isolatedStorage.FileExists(fileName))
isolatedStorage.DeleteFile(fileName);
IsolatedStorageFileStream fileStream = isolatedStorage.CreateFile(fileName);
BitmapImage bitmap = new BitmapImage();
bitmap.SetSource(imageStream);
WriteableBitmap wb = new WriteableBitmap(bitmap);
wb.SaveJpeg(fileStream, wb.PixelWidth, wb.PixelHeight, orientation, quality);
fileStream.Close();
}
}
嗨Sunasara,
我''我在Windows 8应用程序上工作而不是Windows手机。
您能否发布一个Windows 8应用程序的代码。
Hi Sunasara,
I''m working on Windows 8 application not Windows phone.
Could you please post the code for a windows 8 application.
这篇关于在Windows应用商店中保存图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文