Using imagick to create logo from text files
This little script is borrowed heavily from this Stack Overflow post.
#!/usr/bin/env zsh FILE=list.txt typeset -Z4 n=1 # line counter 0-padded to length 4. set -o extendedglob while IFS= read -ru3 line; do # remove NUL characters if any: line=${line//$'\0'} # escape ' and \ characters with \: ESCAPED_LINE=${line//(#m)[\'\\]/\\$MATCH} FILENAME=${ESCAPED_LINE// /-} echo $ESCAPED_LINE convert -gravity center \ -background white \ -fill black \ -size 550x360 \ -font FuturaStd-Condensed.otf \ caption:$ESCAPED_LINE \ -bordercolor white \ -border 25x20 \ "Logos/${FILENAME}-logo.png" done 3< $FILE
Also learned about, which sets and pads the var `n`
typeset -Z4 n=1