question

VijayGawli-1160 avatar image
0 Votes"
VijayGawli-1160 asked ·

[UWP] Getting System.OutOfMemoryException while saving the cropped image using ImageCropper

I am using same code which given in "Windows community toolkit sample App" for cropping the image. For large image file (size 13583x5417, 30mb) I am getting System.OutOfMemoryException while cropping the part of image.

But same image works in "Windows community toolkit sample App" without giving any error and I am able to save the image also.

Here is my code for saving Image -

StorageFolder tempFolder = ApplicationData.Current.TemporaryFolder;
StorageFile imageFile = await tempFolder.CreateFileAsync("current_cropped_image.png", CreationCollisionOption.ReplaceExisting);
if (imageFile != null)
{
BitmapFileFormat bitmapFileFormat = BitmapFileFormat.Png;
using (var fileStream = await imageFile.OpenAsync(FileAccessMode.ReadWrite, StorageOpenOptions.None))
{
await ImageCropper.SaveAsync(fileStream, bitmapFileFormat, true);
}

}

Please help me to solve this issue.

windows-uwp
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I can reproduce this issue, but I'm not sure what caused this unexpected behavior and why the Windows community toolkit sample App could work well. So I will ask the team about this issue.

1 Vote 1 ·

0 Answers