We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

ImageEditor crashes with large images

Hi,

I'm using the ImageEditor and it works fine for small pictures. But if I use for example an image with 5184x3888 pixels (180dpi, 5,6MB) my app crashes with the following exception:

"{System.ArgumentException: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
   at System.IO.UnmanagedMemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   at Syncfusion.UI.Xaml.ImageEditor.BitmapExtension.MergeShapeViewAndImage(WriteableBitmap originalBitmap, WriteableBitmap shapeViewBitmap)
   at Syncfusion.UI.Xaml.ImageEditor.SfImageEditor.getMergedBitmap()
   at Syncfusion.UI.Xaml.ImageEditor.SfImageEditor.getCurrentStream()
   at Syncfusion.UI.Xaml.ImageEditor.SfImageEditor.SaveImage(String format, Size size)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__7_0(Object state)
   at System.Threading.WinRTSynchronizationContextBase.Invoker.InvokeCore()}"

StackTrace:
"   at System.IO.UnmanagedMemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)\r   at Syncfusion.UI.Xaml.ImageEditor.BitmapExtension.MergeShapeViewAndImage(WriteableBitmap originalBitmap, WriteableBitmap shapeViewBitmap)\r   at Syncfusion.UI.Xaml.ImageEditor.SfImageEditor.getMergedBitmap()\r   at Syncfusion.UI.Xaml.ImageEditor.SfImageEditor.getCurrentStream()\r   at Syncfusion.UI.Xaml.ImageEditor.SfImageEditor.SaveImage(String format, Size size)\r   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__7_0(Object state)\r   at System.Threading.WinRTSynchronizationContextBase.Invoker.InvokeCore()"

Do you have any ideas how to fix this problem?

Regards,
Frank Effenberger


12 Replies

VR Vignesh Ramesh Syncfusion Team September 30, 2019 02:13 PM UTC

Hi Frank, 

Greetings from Syncfusion. 

We have checked the reported problem with the image having 5760x3840 pixels (5.0MB) but we cannot reproduce the issue. So, could you please share the tested image and system configurations like OS version, RAM size, VS version, etc. This would help us to proceed further. 

Regards, 
Vignesh. 



FE Frank Effenberger October 1, 2019 05:03 AM UTC

Hi Vignesh,

OS Version: Windows 10 Pro (1809) 64 Bit
RAM-Size: 8GB
Visual Studio Version: Professional 2017, 15.9.13

Regards,
Frank.

Attachment: TestImage_a47e7022.7z


VR Vignesh Ramesh Syncfusion Team October 3, 2019 02:05 PM UTC

Hi Frank, 

Thanks for the response. 

We can reproduce the reported crash with the provided image. Currently we are validating in our side and update you the status on 7th October 2019. We appreciate your patience until then. 

Regards, 
Vignesh. 



FE Frank Effenberger October 8, 2019 08:31 AM UTC

Hi Vignesh,

are there any news regarding the problem?

Regards,
Frank.


VR Vignesh Ramesh Syncfusion Team October 8, 2019 05:58 PM UTC

Hi Frank, 

Sorry for the delay. 

We have checked the issue in our source level. But we are not sure about it is due to our source level issue or framework level issue. Still we are checking the exact root cause of the issue and update you further details on 10th October 2019. We appreciate your patience until then. 

Regards, 
Vignesh. 



BK Bharathiraja K Syncfusion Team October 10, 2019 06:25 PM UTC

Hi Frank,

 

Thanks for your patience. Further analysis with our source, we found that loading large size of image (5184 x 3888) caused insufficient memory exception and it is looks like there is some limitation in framework level. We have raised question in MSDN forum regarding this in the below link.

 

https://social.msdn.microsoft.com/Forums/en-US/98671f24-0a7a-4f5f-bc3c-d8b94a7b4b0f/insufficient-memory-to-continue-the-execution-of-the-program-while-calling

 

We will inform you further details once we get update from MSDN forum. Until that, we suggest you resize the image to (4584, 3438) or according to your machine configuration and save image.

 

Regards,

Bharathi.



FE Frank Effenberger October 11, 2019 03:48 AM UTC

Thank you for your commitment.

Regards,
Frank.


RA Rachel A Syncfusion Team October 11, 2019 11:04 AM UTC

  
Hi Frank, 
 
We are glad to hear from you and will update once we get proper solution. Appreciate your patience until then. 
Thanks, 
Rachel. 



FE Frank Effenberger October 24, 2019 04:48 AM UTC

Hi Rachel,

are there any news regarding the problem?

Regards,
Frank


BK Bharathiraja K Syncfusion Team October 28, 2019 07:17 PM UTC

Hi Frank, 
 
Sorry for the delay in response. We are unable to find the exact root cause of the issue whether it is framework level limitation or source level. So, we are still analyzing this issue with source and public forum. We will update you once we found the solution or root cause of the issue. Please change the image size and use as we suggest in our previous update until then.  
 
Thanks, 
Bharathi. 



FE Frank Effenberger December 20, 2019 06:29 AM UTC

Hi Bharathi,

are there any news regarding the problem?

Regards,
Frank


BK Bharathiraja K Syncfusion Team December 26, 2019 04:01 AM UTC

Hi Frank, 
 
We have checked the problem with source using the suggested solution from MSDN. But, while converting a bitmap image from array of bytes, it takes huge memory and throws out of memory exception. We are unable to handle this in our source since the issues occurs when using framework method to convert to a bit map. So, please use the previous suggested solution.  
 
Regards, 
Bharathi. 


Loader.
Live Chat Icon For mobile
Up arrow icon