Create avatar-generating script

This commit is contained in:
Matt Baer 2018-07-23 13:55:56 +02:00
parent d156f06132
commit 5294be2dc5

25
avatar.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
#
# usage: avatar.sh a
#
# generate alphabet example:
# for x in {a..z}; do ./avatar.sh $x; done
imgtxt=$1
final=$imgtxt.png
if [ -z "$imgtxt" ]; then
echo "usage: avatar.sh text"
exit 1
fi
echo "Generating image..."
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#font_reg=$DIR/fonts/Lora-Regular.ttf
font_reg=$DIR/fonts/OpenSans-Regular.ttf
# Generate post text
convert -background white -fill black -font $font_reg -size 512x512 -pointsize 300 -gravity center -interline-spacing 0 caption:"$imgtxt" $final
echo "DONE. See $(pwd)/$final"