[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.