We are running a large batch job resizing images from 16M Pages and found this jewel of a GIF that makes ImageMagick use several GBs of RAM in a few seconds: https://dl.dropboxusercontent.com/u/214 ... storia.gif
All we need to do is resize first frame so i was wondering if there is any way to tell ImageMagick to just load the first frame. We are using php and there seams to be no way to load just the first frame from that API.
In the meanwhile, to avoid this kind of issues we tried to use identify to see if a GIF has more than 1 frame (to see if it´s animated) but it also loads the memory just by running "identify https://dl.dropboxusercontent.com/u/214 ... storia.gif".
We worked around this by reading the first 100k to see if the gif is animated like this:
Code: Select all
while(!feof($fh) && $count < 2){
$chunk = fread($fh, 1024 * 100); //read 100kb at a time
$count += preg_match_all('#\x00\x21\xF9\x04.{4}\x00\x2C#s', $chunk, $matches);
}
Any help appreciated.