ImageMagick font insanity

After ImageMagick 7.0.8-14, this no longer works:

    convert -pointsize 100 -font ocrabold.ttf label:'A B C' out.jpg
    convert: no pixels defined in cache `A B C[0]' @ error/cache.c/SetPixelCacheNexusPixels/5052.

It works without spaces, or with different TTF files, or with a slightly different point size!

The "label" command doesn't even word-wrap (that's "caption") so I can't guess why it hates spaces now. And only with some fonts and sizes. No amount of backslashing helps.

"Just keep using 7.0.8-14 forever" had been my plan (even though that particular version, conveniently, is no longer on their web site), but as of recently, that no longer compiles. ("no member named 'FlashEC' in 'libraw_imgother_t'").

Previously, previously, previously.

Tags: , , , , ,

7 Responses:

  1. DeathByHula says:

    Regarding the compilation error, do you have a version of libraw >0.19 installed?
    It seems that the structs have changed in newer versions. Replacing the offending line with raw_info->makernotes.common.FlashEC seems to work but might introduce other hilarious side effects when using the newer library.

  2. Dan says:

    Reported and fixed twice in ImageMagick6:, doesn't seem to have been ported to ImageMagick7.

  3. J Greely says:

    I can reproduce the error message with ImageMagick 6.9.11-60 (Macports) as well as 7.1.0-43 (Homebrew), but in both cases the output file is still written correctly.

    Interestingly, it happens at every multiple of 100 points that is not a multiple of 1000, which led me to open it up in FontForge. The font has a bunch of validation errors and warnings (including the amusing "Glyph 257 is called .notdef, a singularly inept choice of name; FontForge will rename it"), but force-converting it to OTF made the ImageMagick error go away, so I'm guessing the problem is specific to the rendering path in specific versions of the  freetype library.

    Here's the OTF version; hope it works for you, too.


    • jwz says:

      Huh. That OTF version works, thanks! But using an online converter to re-convert that back to TTF results in the same error. Weird. I don't remember where I got this font, but if there's a canonical non-sucky OCRABold TTF out there, that would be nice to have. You'd think an ancient ANSI/ISO standard font like this would be easy to find.

  4. Brad J says:

    Thank you for reminding me to once again be glad I don't have to deal with ImageMagick any more.

    I was going to come in and say "try GraphicsMagick!" but I tested with GraphicsMagick and got the same error with slightly different wording, so it's nice to see they've got bug compatibility there.  That said, like J Greely noted, it does create the output file even though it returns 1 and breaks any scripts using it.  (But, seriously, try GraphicsMagick, it's an ImageMagick fork that believes in things like "API stability" and "clean code that gets - and passes - security audits".)

  • Previously