How to just render some text with the given font? Expecting something like:

echo "The slow cyan snail creeps under the eager cat" | render_text --font ./qqq.ttf --scale=18 -o text.png

I expect this to be somewhere in ImageMagick/GraphicsMagick suite.

Example use case: render the same text with multitude of fonts (and don't want to install all fonts into the system).


You can use the convert command. If the font name has more than 1 word, separate them with a "-". Here are some examples using the Kid Kosmic font. Replace "YOURTEXT" with any phrase.

convert -pointsize 15 -font Kid-Kosmic label:"YOURTEXT" output.png

enter image description here

The caption: option enables text wrapping; but you need to specify the image size.

convert -pointsize 15 -font Kid-Kosmic -size 140x100 caption:"YOURTEXT" output.png

enter image description here

Another one with centered text:

convert -pointsize 15 -font Kid-Kosmic -size 140x100 -gravity center caption:"YOURTEXT" output.png

enter image description here

| improve this answer | |
  • PANGRAM FAIL! – RedGrittyBrick Aug 11 '11 at 16:45
  • convert: unable to read font 'Kid-Kosmic' @ warning/annotate.c/RenderType/807... How to point it to the font file (without permanently installing it)? – Vi. Aug 12 '11 at 10:58
  • 4
    Replacing "Kid-Kosmic" with the absolute path to a True Type font works for me on Ubuntu 11.04. What OS are you using? – flashnode Aug 12 '11 at 19:13
  • @flashnode It works for me too, I'm on Win7 Ultimate. Though I had to make sure the path is enclosed in double quotes. – Ellesa Aug 12 '11 at 19:23
  • 1
    For Mac OS, use the full font path as well.. Fonts location: support.apple.com/en-us/HT201722 – Rafael Oliveira Nov 28 '14 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.