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?
fill transparent
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
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
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
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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/