Skip to main content

Fixed: "montage: unable to read font" in ImageMagick on macOS

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

ImageMagick's montage stopped with montage: unable to read font, and the contact sheet it left behind had no labels. This Homebrew build of ImageMagick has no list of fonts, so it had nothing to draw the labels with. Naming a font file with -font, before the images, fixes it.

What I Was Doing​

I was building a contact sheet from a folder of PNG screenshots, so I could review them all at once. I wanted each file's name under its picture. -label "%t" asks for that, and %t is the file name without its extension. Here it is with two sample images, using ImageMagick 7.1.2-34 from Homebrew on macOS:

Terminal
montage -label "%t" one.png two.png -tile 2x1 -geometry 300x160+6+6 sheet.png

What I Expected​

A sheet with two tiles, side by side, with one and two written underneath them.

What I Got​

Output
montage: unable to read font `' @ error/annotate.c/RenderFreetype/1704.

A terminal with the montage command and the message montage: unable to read font, followed by exit code 1.

The exit code was 1, yet sheet.png was written anyway, without any labels.

What I Checked​

Which fonts ImageMagick knows. ImageMagick's -font entry says: "To print a complete list of fonts, use the -list font option". The list is empty:

Terminal
magick -list font | wc -l
Output
0

Whether it can draw text at all. The version output lists what the build includes:

Terminal
magick -version
Output
Version: ImageMagick 7.1.2-34 Q16-HDRI aarch64 c5d4ca8a0:20261014 https://imagemagick.org
Delegates (built-in): bzlib freetype heic jng jpeg lcms ltdl lzma png tiff webp xml zlib zstd

freetype, the library that draws text, is there. So it can draw text, and it just has no font to use. The empty name in the message, `', says the same.

Why It Happens​

The message names RenderFreetype, and the name of the font it tried to read is empty. With no font on the command line and an empty list to choose from, there's nothing to open. The -font entry describes the option as what sets "the font to use when annotating images with text, or creating labels", so a label needs one.

The Fix​

Pass a font file with -font, before the images. macOS keeps fonts in /System/Library/Fonts:

Terminal
montage -label "%t" -font /System/Library/Fonts/Supplemental/Arial.ttf one.png two.png -tile 2x1 -geometry 300x160+6+6 sheet2.png

After the Fix​

No message, and the exit code is 0. The sheet is 14 pixels taller than before, because the labels are there:

Output
sheet.png 624x176
sheet2.png 624x190

A terminal with the same command with a font file, exit code 0, and the new sheet 14 pixels taller than the one before.

And here's the sheet itself:

The finished contact sheet: a blue tile labelled one and a purple tile labelled two.

Common Mistakes​

MistakeWhat happensDo this instead
Putting -font and -label after the imagesNo error, and no labels either: exit code 0, and a sheet of 624x172Put them before the images they apply to
Giving -font a name, such as ArialThe same error, with Arial in the quotes, because the list is emptyGive the path to a font file
Trusting the exit code aloneIt reports 1, yet a sheet is writtenRead the message, and look at the sheet

That first row caught me next. I moved the options to the end of the command, the error went away, and the labels didn't come back.

Troubleshooting​

SymptomLikely causeFix
The same error from magick … -annotateIt draws text too, and there's no fontAdd -font the same way
No error and no labelsThe options come after the imagesMove them before
unable to read font with a path in the quotesThe file isn't thereCheck the path with ls
magick -list font prints a list, and you still get itThe name isn't in the listCopy a name from the list, or use a path

FAQ​

Which font files are on a Mac?​

/System/Library/Fonts and its Supplemental folder hold the ones that come with macOS. ls /System/Library/Fonts/Supplemental lists them.

Is this only on macOS?​

I only ran it on macOS. The check works anywhere: if magick -list font prints nothing, this is the cause.

Conclusion​

montage: unable to read font means ImageMagick was asked to draw text and has no font. Confirm with magick -list font, then name a font file with -font, before the images.

Additional Resources​

Stay Updated

Subscribe to our newsletter for the latest tutorials, tech insights, and developer news.

By subscribing, you agree to our privacy policy. Unsubscribe at any time.