/// <summary> /// Saves the <paramref name="softwareBitmap"/> to the overgiven <paramref name="storageFile"/> /// </summary> /// <param name="softwareBitmap">The picture to save</param> /// <param name="storageFile">The file in which the pictures gets stored</param> /// <returns></returns> public static async Task ToStorageFile(this SoftwareBitmap softwareBitmap, StorageFile storageFile) { using (IRandomAccessStream stream = await storageFile.OpenAsync(FileAccessMode.ReadWrite)) { using (IRandomAccessStream memoryStream = await softwareBitmap.ToRandomAccesStreamAsync()) { await RandomAccessStream.CopyAndCloseAsync(memoryStream, stream); } } }