Round corners

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?".
User avatar
Posts: 25915
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Round corners

Post by fmw42 »

In this example posted above earlier, just add +write mask.png in the parenthesis section at the end when compositing the 4 corners the first time you use it.

convert thumbnail.gif \( +clone -alpha extract \
\( -size 15x15 xc:black -draw 'fill white circle 15,15 15,0' -write mpr:arc +delete \) \
\( mpr:arc \) -gravity northwest -composite \
\( mpr:arc -flip \) -gravity southwest -composite \
\( mpr:arc -flop \) -gravity northeast -composite \
\( mpr:arc -rotate 180 \) -gravity southeast -composite +write mask.png \) \
-alpha off -compose CopyOpacity -composite rounded_corners.png

From then on for the same size input, use the mask in place of all the code in the parentheses before the +write mask.png

Code: Select all

convert thumbnail.gif \
mask.png \
-alpha off -compose CopyOpacity -composite rounded_corners2.png

Post Reply