Browse Source

Create avatar-generating script

master
Matt Baer 2 years ago
parent
commit
5294be2dc5
1 changed files with 25 additions and 0 deletions
  1. +25
    -0
      avatar.sh

+ 25
- 0
avatar.sh 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"

Loading…
Cancel
Save