Create JPG Preview Images for Many Fonts

font-previewIf you’re like me and have a huge stack of TrueType fonts just lying around and don’t want to have to preview them individually by double clicking on them, you might find this handy to throw into a batch file:

for %%a in (*.ttf) do c:\imagemagick\convert.exe -antialias -pointsize 80 -font %%a -draw "text 20,120 'A quick brown fox lazy jumps over dog'" blank.jpg output\%%a.jpg

It requires having ImageMagick installed (I’ve installed it into c:\imagemagick in this example, but you can put it anywhere, obviously). This is a Windows example but should work fine on Linux as well (if you change the path to the ImageMagick binary).

Basically it will write out to the “output” directory a bunch of images rendering the text in that font, allowing you to quickly browse through (or throw into a web page like this to scroll down and compare).

4 thoughts on “Create JPG Preview Images for Many Fonts”

  1. Hey, I’m really a novice at command line editing for this sort of things, but I managed to narrow down my error messages to this and I was wondering if you can help me.

    convert.exe: unable to read font `(8).ttf’ @ warning/annotate.c/RenderType/986

    This gets returned for every file in the directory. It creates the files and each one has the same font. I’m using Windows 10 and running the script through the PowerShell. Any help would be greatly appreciated. Thanks in advance.

  2. Sorry for the noob questions. It turns out the PowerShell was the problem Ran the script directly from explorer and it’s creating the image and populating it. Now, my only question is how can I insert a carriage return into the quick brown fox line. Thanks again.

    Dan

  3. Unable to read font again. So confused. Here’s what my script looks like.

    for %%a in (*.ttf) do c:\IM\convert.exe -antialias -pointsize 80 -font %%a -draw “text 20,120 ‘A quick brown fox lazy jumps over dog'” blank.jpg %%a.jpg

  4. Dan: are the fonts in the same directory as the batch file you’re running it from? The .ttf files all need to be in the same directory.

    You shouldn’t need PowerShell – if you start a “Command Prompt” and change into the directory where the batch file AND the .ttf files are it should be fine.

Leave a Reply

Your email address will not be published. Required fields are marked *