On Fri, 05 Dec 2008 13:40:06 -0600
[EMAIL PROTECTED] wrote:
| Usually I create a roundrectangle -> rounded_corner.mvg
| file and -draw the file on top of my image.
|
| I have an application which requires resizing images,
| drawing a rounded corner border, with the outside perimeter
| transparent.
|
| What's the single convert commend to accomplish this in the
| highest performance manner.
|
The Example you are refering to is at
Border with Rounded Corner
http://www.imagemagick.org/Usage/thumbnails/#rounded_border
As information about the image is needed to generate the MVG, two
separate commands is typically needed. However I think I can fudge up
a single command version. However This will still need a temporary MVG
file which will require later cleanup.
Hmmm....
original command sequence...
convert thumbnail.gif -border 2 \
\
info: > rounded_corner.mvg
convert thumbnail.gif -border 2 -matte -channel RGBA -threshold -1 \
-background none -fill white -stroke black -strokewidth 1 \
-draw "@rounded_corner.mvg" rounded_corner_mask.png
convert thumbnail.gif -border 2 -matte -channel RGBA -threshold -1 \
-background none -fill none -stroke black -strokewidth 3 \
-draw "@rounded_corner.mvg" rounded_corner_overlay.png
convert thumbnail.gif -matte -bordercolor none -border 2 \
rounded_corner_mask.png -compose DstIn -composite \
rounded_corner_overlay.png -compose Over -composite \
rounded_border.png
Single command version (using the new -alpha operator to create a
transparent canvas instead of the threshold method used above)
The mask image has also been adjusted before better working...
convert thumbnail.gif -matte -bordercolor none -border 2 \
-format 'roundrectangle 1,1 %[fx:w-2],%[fx:h-2] 15,15' \
-write info:tmp.mvg \
\( +clone -alpha transparent -background none -fill white \
-stroke none -strokewidth 0 -draw @tmp.mvg \) \
-compose DstIn -composite \
\( +clone -alpha transparent -background none -fill none \
-stroke black -strokewidth 3 -draw @tmp.mvg \) \
-compose Over -composite \
rounded_border.png
Note that the above writes a temporary file, which it then uses later
in the same command. That file "tmp.mvg" will need to be cleaned up
and probably should contain some unique identifier to ensure parallel
running command do not clash.
Anthony Thyssen ( System Programmer ) <[EMAIL PROTECTED]>
-----------------------------------------------------------------------------
I'm an apatheist. The question is no longer interesting,
and the answer no longer matters. -- Petro
-----------------------------------------------------------------------------
Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users