34 lines
743 B
Bash
Executable file
34 lines
743 B
Bash
Executable file
#!/usr/bin/env sh
|
|
# takes two optional arguments
|
|
# -t path to pango formated text file
|
|
# https://usage.imagemagick.org/text/#pango
|
|
# this can be overwritten with the text inside a env var named
|
|
# IMAGE_TEXT
|
|
#
|
|
# -p is a path to write the jpg to
|
|
# alternativly you can write the path into PICTURE_PATH
|
|
set -E -o pipefail
|
|
#shopt -s failglob
|
|
export LC_ALL='C.UTF8'
|
|
|
|
P_PATH="./label.jpg"
|
|
I_TEXT="$(cat ./text.pango)"
|
|
|
|
P_PATH="${PICTURE_PATH:-$P_PATH}"
|
|
I_TEXT="${IMAGE_TEXT:-$I_TEXT}"
|
|
|
|
|
|
while getopts "p:t:" opt
|
|
do
|
|
case "$opt" in
|
|
p) P_PATH="$OPTARG";;
|
|
t) I_TEXT="$OPTARG";;
|
|
esac
|
|
done
|
|
|
|
magick \
|
|
-background '#FFFFFF' \
|
|
-fill '#000000' \
|
|
-font 'FiraCode Nerd Font' \
|
|
-pointsize 72 pango:"$I_TEXT" \
|
|
"$P_PATH"
|