Image-Scale
Image-Scale copied to clipboard
OOM on Windows only(?)
Got a PNG file of 7016 × 7501 size which would cause an OOM on Windows, but not eg. on Mac.
https://dl.dropboxusercontent.com/u/54507676/gorillaz.png
The following script would still print the size, despite the error, but it wouldn't scale it:
#!/usr/bin/perl
use strict;
use Image::Scale;
my $img = Image::Scale->new('gorillaz.png');
print $img->width . 'x' . $img->height . "\n";
$img->resize( {
width => 300,
height => 300,
keep_aspect => 1,
} );
$img->save_png('resized.png');
1;
Tested with 0.08 only, both platforms.
When I add a memory_limit value I get some more information:
Image::Scale memory_limit exceeded (wanted to allocate 210508064 bytes)
Just tried a few more times. And now it would work in about 50% of attempts. Just run the same script over and over again. Sometimes it works, sometimes not....
You need 4 bytes per pixel just to load in an image, and that's where the 210MB comes from. This doesn't count any additional memory libpng needs, etc. This isn't allocated until the resize() call which is why it prints the size ok. 200+MB is a lot but it shouldn't crash unless the system really has a very small amount of memory. Is some kind of memory ulimit (or whatever it's called in Windows) enabled? Have you tried recompiling with debug output enabled? Do other image tools/modules handle it?
I'm sorry for the delay. Need to find some time to set up the Windows build environment again. What exact parameters should I be using?
Tried to compile on Windows, using VC 2005 (VC8). But I already fail compiling lib-1.2.5: it doesn't find masm. There is a copy in the VC10 installation folder though... tried to start from scratch with VC10, but this fails on libjpeg-turbo.
Do you still have a working build environment for our ancient Perl 5.14 on Windows?