https://stackoverflow.com/questions/12499728/create-png-jpg-file-with-commandline-on-mac
The command-line convert utility in the ImageMagick suite can easily create an image of specified dimensions:
convert -size 200x200 xc:white canvas.png
To create an image with text, use additional options:
convert -size 200x200 -gravity center -background white -fill black \
label:"text goes here" canvas.png
The ImageMagick site has many more examples of usage.
To get ImageMagick on OSX, you can either use an automated build system such as MacPorts or run a pre-made installer package.
convert -size 100x100 gradient:blue logo.png