ImagemagickΒΆ

Example pic:

dimensions=300x100
convert -size $dimensions -gravity center label:$dimensions $dimensions.png

http://www.imagemagick.org/Usage/text/