Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert TrueType glyphs to PNG image?

Is there a command line tool to convert glyphs from a TTF file, to PNG (or some other bitmap image format)?

If there is no ready command line tool for that, how would you go about doing it from one of C++, Perl, Python or Ruby or something easily found on an Ubuntu box?

like image 295
Prof. Falken Avatar asked Jun 17 '13 07:06

Prof. Falken


2 Answers

probably partly duplicate of How can I convert TTF glyphs to .png files on the Mac for free?

imagemagick can fulfill this kind of requests, should works fine on Mac/Linux/Windows. :-)

convert -background none -fill black -font font.ttf -pointsize 300 label:"Z" z.png

if a batch convert is needed, maybe you can consider use a little ruby script called ttf2png .

like image 66
imcaspar Avatar answered Sep 22 '22 10:09

imcaspar


The PIL provides an API for this, but it's easy to use. Once you've got the PIL image, you can export it.

like image 43
Mathuin Avatar answered Sep 20 '22 10:09

Mathuin