I want to dynamically render text to an image with a custom font, preferably with the option to output directly or save to a file. And to automatically
Decided to skip the API and use the command-line interface instead.
convert -background lightblue -fill blue -font Arial -pointsize 72 label:Anthony png:-
This returns the raw PNG data, which we can then output to the browser. Replace png:-
with the filename to save to a file instead.
Don't forget to use escapeshellarg if you are using user input as parameters here.