#!/bin/bash
c=0
chap=0
echo Chapter $chap
while read p; do
	if [ -n  "$p" ]; then
		# white sub:
		convert -size 1920x1080 -pointsize 48 -gravity South -background transparent -font Arial -fill black -stroke black label:"$p" -blur 0x2 +repage -fill white -stroke none label:"$p" -composite $(printf %02d $chap)\_$(printf %02d $c)\_white.png
		# black sub:
		convert -size 1920x1080 -pointsize 48 -gravity South -background transparent -font Arial -fill white -stroke white label:"$p" -blur 0x2 +repage -fill black -stroke none label:"$p" -composite $(printf %02d $chap)\_$(printf %02d $c)\_black.png
		c=$((c+1))
	else
		chap=$((chap+1))
		c=0
		echo Chapter $chap
	fi
done

