Last active
September 21, 2018 16:01
-
-
Save cmbuckley/cc1c9dbfc7187cf60e3de9cf264b1759 to your computer and use it in GitHub Desktop.
ImageMagick rounded corners
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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