0

I'm looking for functionality similar to 'convert -alpha off ' command of imagemagick, how to achieve the same using gm node module? I couldn't figure out using their documentation.

Yogeesh Hegde
  • 31
  • 1
  • 3

1 Answers1

1

Using gm node module, you can use the -alpha option (which is not in the documentation yet) this way:

gm('img.png')
  .options({ imageMagick: true })  // enable ImageMagick
  .alpha('Off')
  .write("out.png", function (err) {
    if (err) console.log(err)
  })

You could also achieve the same effect with the now obsolete +matte option.
This option will turn off transparency channel on the image.

gm('img.png')
  .out("+matte")
  .write("out.png", function (err) {
    if (err) console.log(err)
  })
TGrif
  • 5,725
  • 9
  • 31
  • 52