Skip to content

Instantly share code, notes, and snippets.

@cmbuckley
Last active September 21, 2018 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmbuckley/cc1c9dbfc7187cf60e3de9cf264b1759 to your computer and use it in GitHub Desktop.
Save cmbuckley/cc1c9dbfc7187cf60e3de9cf264b1759 to your computer and use it in GitHub Desktop.
ImageMagick rounded corners
#!/bin/bash
# usage: rounded.sh INFILE RADIUS [OUTFILE]
# if OUTFILE is omitted, outputs to STDOUT
size=$2
convert $1 \( +clone -alpha extract -draw "fill black polygon 0,0 0,$size $size,0 fill white circle $size,$size $size,0" \( +clone -flip \) -compose Multiply -composite \( +clone -flop \) -compose Multiply -composite \) -alpha off -compose CopyOpacity -composite ${3:-png:-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment