How to create a transparent image with GraphicsMagick CLI?

0

I'm coming up empty handed while trying to find out how to modify the opacity of an image using the GraphicsMagick CLI. I'm simply trying to input a standard image and convert it to the corresponding image with a reduced opacity. I'm running GraphicsMagick 1.3.14. Using ImageMagick, I can issue the command:

convert input.png -alpha set -channel a -evaluate set 50% +channel output.png

However, the -alpha option (among others) is unrecognized as a valid GM convert option (convert option reference here). Any help would be greatly appreciated.

Note: This question is a cross post of a question on StackOverflow. After posting on SO, I thought SuperUser might be a little more appropriate.

naivedeveloper

Posted 2012-07-03T21:16:59.120

Reputation: 155

Answers

2

The equivalent in GraphicsMagick is

gm convert input.png -operator Opacity Multiply 0.5 output.png

or

gm convert input.png -operator Opacity Assign 50% output.png

depending on what you really want to do (modulate or assign).

You should add -matte prior to -operator if you don't know if the image already has an active opacity channel.

Bob

Bob Friesenhahn

Posted 2012-07-03T21:16:59.120

Reputation: 36

This thread might be of help to some: https://sourceforge.net/p/graphicsmagick/discussion/250738/thread/4ebaf0ed/

– jedierikb – 2015-11-19T03:36:04.947

Thank you Bob; the addition of the -matte operation got me what I wanted. Appreciate the help. – naivedeveloper – 2012-07-06T02:09:09.560