It's a bug in the particular version of ImageMagick you are using, resulting from a incorrect backport of a bugfix patch.
The problematic patch is Debian patch 0161-Do-not-ignore-SetImageBias-bias-value
. I can't tell if that was included in the 14-November-2016 security update to 8:6.7.7.10-6ubuntu3.2
or the 29-November-2016 security patch to 8:6.7.7.10-6ubuntu3.3
(or, at least, I didn't bother trying to figure it out, since it's not that important.) The patch was created as a backport of this security patch, but because of a reorganization of the logic in the file coders/label.c
, the correction ended up being inserted in the wrong place.
In essence, the logic of label.c
is as follows:
- if the image's size or pointsize is not specified, work out the best fit
- if the image's width was not specified, copy it from the computed width
- if the image's height was not specified, copy it from the computed height
- if the image's pointsize was not specified, copy it from the computed pointsize
- make some other relevant settings to image parameters
- Render the text into the image.
The security patch was intended to avoid step 6 if the resulting image size could not be used. This avoids a possible Denial of Service attack when ImageMagick is being used on a web back-end (which is common). It adds:
3a. If the image dimensions are unusable, immediately fail.
Unfortunately, in the version to which to patch is applied, the above steps were in a different order, with the third step being intermingled with step 5. (This made no real difference, as far as I can see, but it was a bit disorganized, which is probably why it was subsequently fixed.) The result is that the added step 3a is inserted before the image's height has been copied from the computed height. This causes the check to fail if the image did not originally have a height, even though a correct height had been computed at that point.
The instructions clearly indicate that a label:
source does not require a -size
(or -pointsize
) parameter. But with the misplaced patch, this turns out to be incorrect; unless a height is specified in the geometry, the label will not be generated.
I haven't generated a bug report for this because it only applies to an outdated version of ImageMagic on an outdated version of Ubuntu (and possibly of Debian). It happens that I and OP are both using this outdated version of Ubuntu on some machine, and my recommendation to both of us is to upgrade. But in case anyone else has this problem, I'm answering the question (which I found when trying to research the identical problem on my machine.)