Page 1 of 1

Making a simple transparent rectangle.

Posted: 2011-02-12T02:18:12-07:00
by The Transporter
Hello,

I'm trying to make a simple transparent square using:

Code: Select all

convert -size 200x200 xc:none -fill '#0008' square.png
But if doesn't work.

I've read on the forum that I need to use dstOut but I don't find any example.

Can you provide a simple example who draws a square or a rectangle filled with a color and where we can set a transparency ?

Thanks alot!

Re: Making a simple transparent rectangle.

Posted: 2011-02-12T02:54:07-07:00
by Bonzo
Not sure what you mean as you want a transparent rectange filled with colour - that is what you created with your code.

Do you want a rectangle that is colored but you can set the opacity ?
Try this using the RGB alpha setting.

Code: Select all

convert -size 200x200 xc:rgba(255, 0, 0, 0.4) square.png

Re: Making a simple transparent rectangle.

Posted: 2011-02-12T10:49:44-07:00
by fmw42
convert -size 200x200 xc:rgba(255, 0, 0, 0.4) square.png
This might need quotes so that the spaces are not interpretted

convert -size 200x200 xc:"rgba(255, 0, 0, 0.4)" square.png

Re: Making a simple transparent rectangle.

Posted: 2011-02-12T18:43:10-07:00
by anthony
You did not mention your IM version number.

Some of the recent IM releases had PNG problems
use png32:square.png if the direct to png approach is not working (you get opaque or fully-transparent).
Upgrade if you are not sure.