aheckmann / gm

GraphicsMagick for node
http://aheckmann.github.com/gm/
6.95k stars 614 forks source link

Delay does not work when using imagemagick subclass #423

Open jkoidahl opened 9 years ago

jkoidahl commented 9 years ago

I was attempting to convert some pngs to an animated gif and remove the alpha channel but delay does not work when subclassing as imagemagick. The result from the code below is an animated gif that has alpha channel removed but no delay. I currently have imagemagick 6.9.1-1 and graphicsmagick 1.3.21 installed for Osx

var gm = require('gm').subClass({ imageMagick: true });
gm(IMAGES_DIRECTORY_PATH + 'animateMe_*.png')
      .delay('100')
      .alpha('remove')
      .write(IMAGES_DIRECTORY_PATH + 'animated.gif', function(err) {
        if (err) {console.error('Error while converting animated file: ', err); }
      });
ej52 commented 7 years ago

Having the same issue here using windows ImageMagick 7.0.7-8 Q16 x64 and GM 1.23. Using the CLI convert and magick works perfectly fine though.

Issue seems to be that the delay is set as a out arg _out: [ '-delay', '100', '-resize', '600', '-depth', 8, '-fuzz', '10' ],

setting the delay as a in arg fixes the issue [ '-delay', 100, 'image1.jpg', 'image2.jpg',