Created
April 14, 2022 05:10
-
-
Save chsh/ad8992d4ca478c10f1f16c1a534ecda6 to your computer and use it in GitHub Desktop.
Crop square image to circle.
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: to-path.sh files(to crop circle) | |
# | |
for path in "$@" | |
do | |
convert $path \( +clone -threshold -1 -negate -fill white -draw "circle `identify -format %w $path | awk '{print $1/2}'`, `identify -format %h $path | awk '{print $1/2}'` `identify -format %w $path | awk '{print $1/2}'`, 0" \) -alpha Off -compose copy_opacity -composite circle-`basename $path` | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment