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.
Asked
Active
Viewed 1,195 times
1 Answers
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
-
It seems to be `alpha("remove")`. That's what worked for me – vishesh Jul 19 '21 at 13:55