Out of memory error in processing large images of size 50 MB #579
-
System ConfigurationCode is running on AWS ECS container CPU 512MB , Hard/Soft Memory Limits 1024 MiB
QuestionI'm using MagickNet to process images and convert them to thumbnail. It works perfectly for images till 45 MB, But when i upload image of size 50 MB the aws ECS instance runs out of memory and the container restarts itself. Please find the below code using (var image = new MagickImage(bytes)) <<-- This line throws out of memory error in case of large files 50 Mb |
Beta Was this translation helpful? Give feedback.
Replies: 12 comments 1 reply
-
Have you tried to set memory limit usage? Documentation Like this: |
Beta Was this translation helpful? Give feedback.
-
Can we close this issue @rajatg64? |
Beta Was this translation helpful? Give feedback.
-
hi all any help is highly appreciated. |
Beta Was this translation helpful? Give feedback.
-
The size of the file does not really matter. The number of pixels determines how much memory you need. Can you clarify what you mean by "not working"? And can you share a file that demonstrates this issue. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick reply. ResourceLimits.LimitMemory(new Percentage(100)); it throws me an exception, |
Beta Was this translation helpful? Give feedback.
-
just an update, the Same file im able to load using ImageMagick command line. |
Beta Was this translation helpful? Give feedback.
-
In what kind of environment are you running this? Your images probably requires |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply. The image im trying to load is a CMYK image, so i understand the Size to be 16000x10000x4. |
Beta Was this translation helpful? Give feedback.
-
If you have a CMYK image you will indeed need to multiply it by 4. And that makes the total required memory 2.56 GB Is your .NET application running in a 32bit environment? That is the only reason I could think of why this would not work in your .NET application. What happens when you switch to the |
Beta Was this translation helpful? Give feedback.
-
yes, my .Net application is in AnyCPU. |
Beta Was this translation helpful? Give feedback.
-
Magick.Net-Q16-AnyCPU is supposed to support both x64 and x86, |
Beta Was this translation helpful? Give feedback.
-
many thanks.. |
Beta Was this translation helpful? Give feedback.
yes, my .Net application is in AnyCPU.
So now instead of Magick.Net-Q16-AnyCPU, i used Magick.Net-Q16-x64 , and now im able to load the image.