Page 1 of 1

fill transparent

Posted: 2006-11-13T10:15:05-07:00
by dognose
I'm trying to make a transparent rectangle (ie. putting a hole in the image)

I've tried:
convert -size 100x60 xc:skyblue -fill transparent -draw "roundrectangle 20,10 80,50 20,15" draw_rrect.gif

However, that doesn't work. I guess it's just drawing a transparent rectangle, which makes sense. So, the question is, how do I make a real transparent rectangle?

Posted: 2006-11-13T13:16:16-07:00
by Bonzo
You may be able to get this all on one line but this should work:

Code: Select all

convert -size 100x60 xc:skyblue -fill red -draw "roundrectangle 20,10 80,50 20,15" draw_rrect.gif 

convert draw_rrect.gif  -fuzz 50% -transparent red transparent.gif

Posted: 2006-11-15T20:58:08-07:00
by anthony
That will work, but work BADLY!

the correct solution is to use alpha composition.

Create a transparent canvas, draw your hole shape as normal, then use Alpha Composition
"Dst_Out" to punch that shape from the image.
See http://www.cit.gu.edu.au/~anthony/graph ... se/#dstout