0
我建設,需要採取帶攝像頭的照片,並將其保存到本地磁盤上的應用程序,到目前爲止,我有這樣的:C#保存JPEG具體路徑當地
async private void CapturePhoto_Click(object sender, RoutedEventArgs e)
{
Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
ImageEncodingProperties imgFormat = ImageEncodingProperties.CreateJpeg();
// create storage file in local app storage
StorageFile file = await localFolder.CreateFileAsync("TestPhoto.jpg", CreationCollisionOption.GenerateUniqueName);
StorageFile localFile = await localFolder.CreateFileAsync("webcamPhotoTest.jpg", CreationCollisionOption.ReplaceExisting);
// take photo
// save to app storage
await captureManager.CapturePhotoToStorageFileAsync(imgFormat, file);
// save to local storage
await captureManager.CapturePhotoToStorageFileAsync(imgFormat, localFile);
// Get photo as a BitmapImage
BitmapImage bmpImage = new BitmapImage(new Uri(file.Path));
// imagePreview is a <Image> object defined in XAML
imagePreview.Source = bmpImage;
}
我能救的JPG圖像既可以應用存儲和本地存儲,但我需要能夠 一)指定保存到 b中的路徑),這樣做,而無需用戶交互(例如,Windows保存文件的提示)
有沒有支持在Windows 8應用程序中進行System.Drawing,這會使事情變得複雜。我發現的大多數答案都使用了System.Drawing功能或Windows的「保存文件提示」。
你知道你想要保存它嗎?也許看看這裏:http://stackoverflow.com/questions/4161359/save-bitmapimage-to-file –
是的,但現在任何地方都可以。以後可以隨時更改路徑。點是能夠指定它。您提供的鏈接似乎是關於下載和保存,而不是從應用程序保存。 – Essah