Monthly Archives: June 2012

Rounded Corner Script

Script Download: rounded_corner.sh (v2)

Ever wanted a script that would round the corners of images for you?  Well, if you said yes, I wrote myself a bash script to do just that.  As of this post it can do the following: round of corners of images and it can also add a glass-bubble effect as described in the ImageMagick tutorials.  You can specify the border radius and a background color, which is handy if you are making JPEGs.  The script’s help screen is shown below, as well as a couple of samples.  Radius sizes are in pixels.

./rounded_corner.sh <inputfile> <outputfile> [options]
  -m   Method [plain or glass-bubble]
  -r   Corner Radius
  -b   Background Color
Method can be plain or glass-bubble at the moment. (default: plain)
Radius specifies the radius of the rounded corners. (default: 15)

Note: This should be able to function as filter command, so if you wanted
rounded thumbnails of a particular size you can:
convert <bigfile> -resize 200x200 png:- | ./rounded_corner.sh png:- smallrounded.png" 1>&2