Reputation: 2011
Im using the awesome ImageResizing component and am experiencing an "Out of memory" error when trying to upload and read images that are about 100MB in size. It may seem large, but we're a printers so many people do need to provide images of that size.
The line of code that fails is:
ImageResizer.ImageBuilder.Current.Build(Server.MapPath(strImagePath), Server.MapPath(strThumbPath), new ResizeSettings("maxheight=" + "150"+ "&maxwidth=" + "238"));
This is probably the GDI itself failing, but is there any workaround other than detecting the error occured and letting the user know?
Thanks in advance Al
Upvotes: 1
Views: 513
Reputation: 555
As mentioned by Lilith River, libvips is capable of resizing large images with low memory needs. Fortunately, there is now a full libvips binding for .NET available: https://github.com/kleisauke/net-vips/.
It should be able to process 100MB jpeg files without any problems.
Upvotes: 0
Reputation: 16468
A 100MB jpeg generally decompresses to around 8 gigabytes in bitmap form. Your only chance of getting that to work is getting 16 GB of RAM and running the process in 64-bit mode.
Alternatively, you could try libvips - it's designed for gigantic image files. There's no .NET wrapper yet, but I really want to make one and get some ImageResizer integration going! Of course, without anyone interested in funding that, it probably won't happen for a while....
Upvotes: 4