Very cool! Is it possible to have imagemagick fill out the png after calculating the result?
Something like convert -background white -fill black -font Arial -pointsize 24 -size 300x caption:@output.txt output.png
If we remove the background with -background transparent -fill black
Then merge the output with the result with convert background.png overlay.png -composite output.png
it might work