Search code examples
imagemagickgraphicsmagick

How to use GraphicsMagick to negate the alpha channel of a picture


I want to invert a image with transparent background, i.e. from

enter image description here, transparent background

to

enter image description here, transparent "We"

In ImageMagick, we can do this by

convert 1cut.png -channel a -negate +channel 1cut_nega.png

as mentioned in http://www.imagemagick.org/discourse-server/viewtopic.php?t=18842

What is the equivalent command in GraphicsMagick?

If I use $ gm convert -channel opacity -negate +channel example/we.png output/we.png, I got a white "We" instead of transparent "We"


Solution

  • I think this is what you want:

    gm convert 61I23.png -operator matte negate 1 result.png