transparent roundrectangle and composite

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
complete_beginner

transparent roundrectangle and composite

Post by complete_beginner »

Hello,

I'm preparing some teaching material for the students in regards to a Linux Shell. I got a screen shots of Linux terminal which is black letters on white background.
Image
http://cyberwar.netfirms.com/test.gif
I'm more sys admin that graphic designer so I spend couple hours to find out how can I place transparent yellow roundedrectangle over my image.
As suggested on this forum, before a placed this question to the forum I have done some research and I found:
http://www.imagemagick.org/Usage/compose/#blend_use
however if covers the whole image. So I have tried to create rectangle first and that use composite and I ended with this:

Code: Select all

convert -size 500x25 xc:yellow rec.png   
composite -compose over -gravity center rec.png test.gif test_.gif

Image
http://cyberwar.netfirms.com/test_.gif
how do I make this yellow rectangle round and transparent so I can see what is behind it? Any hints are appreciated.

thank you
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: transparent roundrectangle and composite

Post by Bonzo »

Your host will not allow your image links !

Is this what you are trying to do ?
Image

Code: Select all

convert -size 637x140 xc:none -fill white -draw "roundRectangle 0,0 637,140 15,15" albir.jpg -compose SrcIn -composite rounded_corners.png
complete_beginner

Re: transparent roundrectangle and composite

Post by complete_beginner »

Hello Bonzo,

Thank you for your reply. Can you please try this link:
http://cyberwar.netfirms.com/test.html

basically I would like to make that yellow rectangle round so it does not reach both ends of a background image and also that yellow rectancle should be transparent.

let me know if you still can see my images.

thank you
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: transparent roundrectangle and composite

Post by Bonzo »

I can see you images now.

I tried to get this all onto one line of code but it didn't work so I have created the yellow image seperatly. If you are going to be doing quite a lot of "highlighting" it would be quicker to have the mask already on the server anyway and call it up.

Code: Select all

convert -size 500x25 xc:none -fill yellow -draw "roundRectangle 0,0 484,10 3,3" mask.png
composite -blend 60 -gravity center mask.png http://cyberwar.netfirms.com/test.gif -matte output.jpg
Image
complete_beginner

Re: transparent roundrectangle and composite

Post by complete_beginner »

great this is exactly what I wanted.

Thank you for your help. :D
Post Reply