Created
April 27, 2023 03:27
-
-
Save ahaxu/8c36a8cf906f93129bd5fb934adbdf69 to your computer and use it in GitHub Desktop.
ecert generate
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 | |
set -e | |
slugify () { | |
echo "$1" | iconv -c -t ascii//TRANSLIT | sed -E 's/[~^]+//g' | sed -E 's/[^a-zA-Z0-9]+/-/g' | sed -E 's/^-+|-+$//g' | tr A-Z a-z | |
} | |
NAME=$1 | |
DISTANCE=$2 | |
LOOPS=$3 | |
TOTAL_TIME=$4 | |
UNAME=$(echo "$NAME" | awk '{print toupper($0)}') | |
SOURCE_BG="./htmt-ecert-bg.jpeg" | |
OUTPUT=`slugify "$NAME"` | |
echo $UNAME | |
echo "wrote file to $OUTPUT.jpg" | |
convert -font "iosevka-bold" \ | |
-fill black -pointsize 130 -gravity center \ | |
-draw "text 0,-300 '$UNAME'" \ | |
$SOURCE_BG "$OUTPUT-1.jpg" | |
convert -font "chalkboard" \ | |
-fill black -pointsize 90 -gravity center \ | |
-draw "text 0,-150 'DISTANCE: $DISTANCE KM" \ | |
"$OUTPUT-1.jpg" "$OUTPUT-2.jpg" | |
convert -font "chalkboard" \ | |
-fill black -pointsize 90 -gravity center \ | |
-draw "text 0,0 'LOOPS: $LOOPS" \ | |
-draw "text 0,150 'TOTAL TIME: $TOTAL_TIME" \ | |
"$OUTPUT-2.jpg" "$OUTPUT-cert.jpg" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run with