Transparencies from the command line

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
mattalexx

Transparencies from the command line

Post by mattalexx »

From the command line, is there any possible way to play around with transparencies? I would like to be able to dynamically print text on a gif or png, but have the font actually act like a mask that lets the background show through. So the actual opaque part of the image is the negative space around the text.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Transparencies from the command line

Post by Bonzo »

Something like this: http://www.rubblewebs.co.uk/imagemagick ... adiant.png

You could setup a form and read the input into a variable; then use the variable in the mask. There may be another way to do it but that seems simple to me.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Transparencies from the command line

Post by anthony »

There is a quite a number of techniques you can use. using the background image as a tiled 'fill color', See...
http://www.imagemagick.org/Usage/text/#size

or a white font on a black background as a greyscale mask
http://www.imagemagick.org/Usage/channels/#masks
http://www.imagemagick.org/Usage/channe ... ed_compose
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
mattalexx

Re: Transparencies from the command line

Post by mattalexx »

Thank you Anthony. That was perfect. I can't believe I can do this through the command line!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Transparencies from the command line

Post by anthony »

That shows you the power of IM and why it has gained popularity. people only needed to know what it can do, and IM examples filled that need.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply