-
-
Notifications
You must be signed in to change notification settings - Fork 852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image Crop on one Gif results in out of memory error #2848
Comments
Hmmm.... This is a BIG gif and I don't think there's much I can do. The problem here is that we have to allocate enough memory for both the source and target image since crop requires a clone to be created. Source (2545 x 1375 x 100 x 4 bytes) / 1024 / 1024 = 1.334GB Destination (850 x 460 x 100 x 4 bytes) / 1024 / 1024 = 149MB Azure POV3 has a maximum of 4GB memory available and I've no idea how what resources the application takes and how much traffic there is but I imagine it's probably a struggle to maintain that much available memory for an individual operation. |
@RachBreeze can you share the exception info including the stack trace? |
Thank you both for your quick response @JimBobSquarePants that's a great spot let me see if we can do some file size reduction at our end, I will keep your posted. If we can't @antonfirsov I will defiantly include the exception info for you |
@RachBreeze the reason I asked is that if it's a system OOM, there is a way to configure a memory limit for the library, so you will get an See details here: https://docs.sixlabors.com/articles/imagesharp/security.html |
Hi @JimBobSquarePants and @antonfirsov I didn't capture the error message other than it was Out Of memory, please forgive me. Just to flag that this file https://github.com/RachBreeze/ImageSharp.Payloads/blob/main/blob/bluebeam.gif is 13.5 mb not gb. I also have it eating memory locally on a 32 GB machine (31.7GB usable) . The specs are:
|
That's the size of the compressed gif file. When you unpack it into an in-memory Where do such images come from? Is it uplodaded by users? Is filtering out such inputs (eg. at upload time) an option? |
Hi @antonfirsov Apologies for not getting back to you sooner, the image is uploaded by the client. It was originally uploaded in an older .net framework version of the site (I can't point to the exact version it was uploaded using), and has been served without issue there. The dll versions currently being used in .netframework are ImageProcessor, Version=2.9.1.225 and ImageProcessor.Web, Version=4.12.1.216 I have uploaded another example image here https://github.com/RachBreeze/ImageSharp.Payloads/blob/main/blob/24-naviate-accelerate-24-3-1-placeviews_exportimport.gif which also has the same issue. |
ImageProcessor uses System.Drawing under the hood which probably has an optimized frame-by frame implementation for doing DrawImage that implements crop. This is not possible in ImageSharp by design since an |
Prerequisites
DEBUG
andRELEASE
modeImageSharp version
3.1.6
Other ImageSharp packages and versions
SixLabors.ImageSharp.Web 3.1.3.0 SixLabors.ImageSharp.Web.Providers.Azure 3.1.3.0
Environment (Operating system, version and so on)
Microsoft Azure Web App
.NET Framework version
.net 8
Description
Hello
We have a file that causes an OOM Exception when cropped.
The file is here https://github.com/RachBreeze/ImageSharp.Payloads/blob/main/blob/bluebeam.gif
The crop that causes the issue is width width=850 and height=459.23379174852647
The site is hosted on Azure Web App P0V3
Thank you in advance for all your help
Steps to Reproduce
The image is in an Umbraco 13.5.2 site and is loaded into the website via bluebeam.gif?width=850&height=459.23379174852647
Images
No response
The text was updated successfully, but these errors were encountered: