montage: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1316.

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
qubodup
Posts: 31
Joined: 2009-10-07T13:11:41-07:00
Authentication code: 8675309

montage: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1316.

Post by qubodup »

Using montage triggers a warning or error:

Code: Select all

$ montage a.jpg b.jpg test.jpg
montage: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1316.
The image output seems fine but the command line output still seems strange.

Code: Select all

$ montage --version
Version: ImageMagick 6.9.5-5 Q16 x86_64 2016-08-07 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenCL OpenMP 
Delegates (built-in): bzlib cairo fontconfig freetype gslib jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps rsvg tiff webp wmf x xml zlib
Arch Linux 64bit.

This might have to do with the fact that montage does (or only did in the past) add annoataions (or labels?) to images automatically, if they have a title in their exif metadata. I used to have to use the following to remove the metadata to surpress such labels.

Code: Select all

exiftool -all= file.png -overwrite_original
I'm just mentioning it, even though I haven't tested it recently and it's not the problemhere but might be related.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: montage: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1316.

Post by fmw42 »

This works fine for me on IM 6.9.5.5 Q16 Mac OSX

Code: Select all

convert rose: rose1.jpg
convert rose: rose2.jpg
montage rose1.jpg rose2.jpg result.jpg
Does montage work without error, if you add -font Arial or some other font? If not, then perhaps your freetype is flawed or outdated.

These images have no comment field. What do you mean by "title" in EXIF? Do you mean comment or label field? What version used to add it automatically. Usually you have to use -label in montage to get it to add text.

If I do this, I do not see any text from montage:

Code: Select all

convert rose1.jpg -set comment "rose1" rose1.jpg
convert rose2.jpg -set label "rose2" rose2.jpg
montage rose1.jpg rose2.jpg result.jpg
What happens if you run

Code: Select all

convert -background white -fill white -pointsize 36 label:"testing" result.jpg
Do you get the same message? If so, then perhaps your system has not defined a default font.
User avatar
qubodup
Posts: 31
Joined: 2009-10-07T13:11:41-07:00
Authentication code: 8675309

Re: montage: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1316.

Post by qubodup »

Trying to split the two issues.

Default font issue
fmw42 wrote:Does montage work without error, if you add -font Arial or some other font? If not, then perhaps your freetype is flawed or outdated.
If I specify a font that is available in

Code: Select all

convert -list font
then it works without warning. (Arial is commonly not present on Linux, although some distributions might have links from it to an open alternative I guess.)
fmw42 wrote:Do you get the same message? If so, then perhaps your system has not defined a default font.

Code: Select all

$ convert -background white -fill white -pointsize 36 label:"testing" result.jpg
convert: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1316.
convert: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1316.
convert: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1316.
convert: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1316.
The error is new to me.

As far as I'm concerned, this started with 6.9.5.4 or 6.9.5.5

If I remove the colors it does render text with the same warning.
So either you're right and my system used to specify a default font but does not any more or imagemagick just started implementing this warning:
WARNING: If the font requested is not found, ImageMagick used to silently substitute a default font, typically Arial or Times. It still does this, but a warning is now given. So, test the font beforehand, to make sure that it is the one you want, and not the default font.
(from http://www.imagemagick.org/Usage/#font )

So far I know nothing about Linux-wide settings regarding default font (except for Xorg but I think I only changed that for terminal shells).

I wonder: should there be a default font defined on Linux, causing Imagemagick not to complain or is it normal on Linux that no default font is defined and Imagemagick is supposed to always warn if no font is specified?

Montage auto label issue
fmw42 wrote:These images have no comment field. What do you mean by "title" in EXIF? Do you mean comment or label field? What version used to add it automatically. Usually you have to use -label in montage to get it to add text.

Code: Select all

$ convert result.jpg -set comment "rose1" rose1.jpg
$ convert result.jpg -set label "rose2" rose2.jpg
$ montage rose1.jpg rose2.jpg result.jpg
montage: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1316.
This produces images without labels.

The following produces labels (annotations? titles?) in the montage:

Code: Select all

$ convert -size 140x80 label:"TEST" test.png
$ montage test.png test.png -geometry +0+0 montage.png
Image
I think the last time I worked with a script that produced such content was 2013 or 2014, haven't tested since until now.
Version: ImageMagick 6.9.5-5 Q16 x86_64 2016-08-07

I don't know much about image metadata.

Code: Select all

$ exiftool test.png |grep Label
Label                           : TEST
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: montage: unable to read font `(null)' @ error/annotate.c/RenderFreetype/1316.

Post by fmw42 »

You apparently have no system default font. I do not know why IM is not picking another unless it is trying to use Arial and you do not have Arial on your system. If it works by specifying a font, then you should always provide the desired font and not rely upon any default. I do not know much about Linux and default fonts. But on my Mac, your command works fine without specifying a font. But it looks like the default font is Arial.

Second, it appears that doing:

Code: Select all

convert -size 140x80 label:"TEST" test.png
montage test.png test.png -geometry +0+0 montage.png
in the convert command, you are creating an image with the word TEST as pixels in the image and also it is setting the meta data label to "test"

identify -verbose test.png
...
Properties:
date:create: 2016-08-09T20:53:28-07:00
date:modify: 2016-08-09T20:53:28-07:00
label: TEST
label:pointsize: 53.25
...

montage must then be accessing the label field by default rather than needing to specify -label in the command and so is applying the word "test" in the border as well as showing the image with the word TEST as pixel data.

According to http://www.imagemagick.org/Usage/montage/#label

"You can also label images differently by setting label of individual images. Either option can be used, though you will need to use of parenthesis to limit what images the "-set" operator will be applied to."
Post Reply