Created
March 10, 2020 17:22
-
-
Save croaky/be85d1d8abffc372b42b47777903b269 to your computer and use it in GitHub Desktop.
Make a circular favicon from your GitHub avatar
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 | |
# Make a circular favicon from your GitHub avatar | |
# | |
# ./favicon.sh username | |
set -eu | |
if ! command -v convert >/dev/null; then | |
echo "error: ImageMagick isn't installed." >&2 | |
exit 1 | |
fi | |
if [ $# -eq 0 ]; then | |
echo "error: No GitHub username provided." >&2 | |
exit 1 | |
fi | |
curl -L "https://github.com/$1.png?size=32" -o input.jpg | |
convert input.jpg \ | |
-gravity Center \ | |
\( -size 32x32 \ | |
xc:Black \ | |
-fill White \ | |
-draw 'circle 16 16 16 1' \ | |
-alpha Copy \ | |
\) -compose CopyOpacity -composite \ | |
-trim favicon.ico |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment