0
我使用 拍攝了照片cameracaptureui,並且我在圖像控制中擁有圖像。 現在的問題是如何將捕獲的圖像保存到我的數據庫。 通常我通過將圖像轉換爲Byets在Windows窗體中完成此任務。但現在在UWP中有點混亂。 由於事先如何使用UWP將圖像保存到azure mysql數據庫
我曾嘗試:`
private async void button_Copy_Click(object sender, RoutedEventArgs e)
{
//create camera instance with camera capture ui
CameraCaptureUI captureUI = new CameraCaptureUI();
captureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg;
captureUI.PhotoSettings.CroppedSizeInPixels = new Size(200, 200);
StorageFile photo = await captureUI.CaptureFileAsync(CameraCaptureUIMode.Photo);
if (photo == null)
{
// User cancelled photo capture
return;
}
//return the captured results to fram via bitmap
IRandomAccessStream stream = await photo.OpenAsync(FileAccessMode.Read);
BitmapDecoder decoder = await BitmapDecoder.CreateAsync(stream);
SoftwareBitmap softwareBitmap = await decoder.GetSoftwareBitmapAsync();
SoftwareBitmap softwareBitmapBGR8 = SoftwareBitmap.Convert(softwareBitmap,BitmapPixelFormat.Bgra8, BitmapAlphaMode.Premultiplied);
SoftwareBitmapSource bitmapSource = new SoftwareBitmapSource();
await bitmapSource.SetBitmapAsync(softwareBitmapBGR8);
imageControl.Source = bitmapSource;
}
我應該提供什麼樣的路徑? –
@ SheikhMuhammadAmaan-Ullah這是你的應用程序本地文件夾閱讀[這裏](http://stackoverflow.com/questions/18156706/get-local-folders-from-app-winrt)。 – Irfan
將拍攝的圖像保存到應用程序本地狀態文件夾。 – Irfan