how to set semi-transparent background but not text on it

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
ravikum
Posts: 34
Joined: 2013-03-20T05:35:37-07:00
Authentication code: 6789

how to set semi-transparent background but not text on it

Post by ravikum »

hello,
I want to write some message on a semi transparent background.

So, I am using this code :

Code: Select all

/usr/local/bin/convert -size 250x -background '#aaff00' -alpha set -channel A -evaluate set 50% -font Verdana -density 96 -pointsize 14 -fill '#e80b0b' -gravity Center caption:'Long Test Message' output.png
However, this code is making the caption also as transparent.

I don't want the capton to be transparent.
I need to composite this image on another image.

Please suggest.

Thanks

(I am using the latest IM version on linux centos 6)
(using the latest IM version on linux centos 6)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: how to set semi-transparent background but not text on i

Post by snibgo »

Commands should be given in the "natural" order: do something, then do something else, etc. If you give them in a weird order, results will be weird.

You put "-evaluate set 50%" before you have created the image, which doesn't happen until "caption:".

You could do it like this:

Code: Select all

convert -size 250x -background '#aaff0080' -fill '#e80b0b' -gravity center caption:'Long test message' r.png
I have specified the transparency as a 4th channel to the background.
snibgo's IM pages: im.snibgo.com
ravikum
Posts: 34
Joined: 2013-03-20T05:35:37-07:00
Authentication code: 6789

Re: how to set semi-transparent background but not text on i

Post by ravikum »

thanks a lot for quick reply.
I will try this code.
(using the latest IM version on linux centos 6)
Post Reply