Created
September 3, 2023 13:09
-
-
Save jakkn/2ce1983f0d802733886d8324b02710b3 to your computer and use it in GitHub Desktop.
SVG to 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 | |
INPUT_FILE=$1 | |
BG_COLOR=${2:transparent} # May be hex code or color name | |
if [ -z "$INPUT_FILE" ]; then | |
echo "Usage: $0 <input.svg> <bg-color>" | |
exit 1 | |
fi | |
INPUT_FILE_AS_PNG="$(basename "$INPUT_FILE" .svg ).png" | |
inkscape -w 250 -h 250 "$INPUT_FILE" -o "$INPUT_FILE_AS_PNG" | |
convert "$INPUT_FILE_AS_PNG" -background "$BG_COLOR" -gravity center -scale 250x250 -extent 400x400 "$INPUT_FILE_AS_PNG" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment