0

I'm trying to resize GIF and PNG images using imagemagick.

Sometimes it fails just trying to identify the images:

    im.identify(tempFilePath, function(err, features){
      if (err) {
        console.log(err);
        return next();
      }
    }

So usually the process completes without issue, with both PNG and GIF. But when I upload a specific GIF image (sent to me by user, is a working gif file), I get this error:

{"error":{"timedOut":false,"killed":true,"code":null,"signal":"SIGKILL"}

I can't figure out what this means, seems like it maybe has to do with memory? Is there a way to prevent this from happening?

stackers
  • 2,701
  • 4
  • 34
  • 66
  • Could be killed by the OOM killer. How big is the image file? – xenoid Oct 13 '19 at 15:44
  • It's only 300k, at 256x256 with 127 frames – stackers Oct 13 '19 at 15:54
  • 127 frames at 256x256 is 8MB if palettised, 24MB if RGB and 48MB if 16-bit RGB. – Mark Setchell Oct 13 '19 at 17:22
  • Is that bad though? Why does it have to load the whole image at once? – stackers Oct 13 '19 at 17:47
  • I don't know if it's bad, I don't know if you are running on a 512MB Raspberry Pi or a 1.5TB Mac Pro, I was just correcting your figure. It does need all frames in memory at once because it normally does colour palette optimisation across all the frames so they use a common palette. – Mark Setchell Oct 13 '19 at 17:57
  • I tried using and jimp/gifsicle instead and they're working without crashes, so I guess I'll just stick with that. – stackers Oct 13 '19 at 19:26

0 Answers0