C#保存JPEG具体路径当地

问题描述:

我建设,需要采取带摄像头的照片,并将其保存到本地磁盘上的应用程序,到目前为止,我有这样的: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的“保存文件提示”。

+0

你知道你想要保存它吗?也许看看这里:http://stackoverflow.com/questions/4161359/save-bitmapimage-to-file –

+0

是的,但现在任何地方都可以。以后可以随时更改路径。点是能够指定它。您提供的链接似乎是关于下载和保存,而不是从应用程序保存。 – Essah

你不能真正使用任何你想要的位置。有您可以从您的应用访问的位置列表:File access and permissions in Windows Store apps。某些位置需要在项目的清单文件中进行额外的声明。