IM7 issue using "label:" for multi-line text...

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
GeeMack
Posts: 469
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

IM7 issue using "label:" for multi-line text...

Post by GeeMack » 2017-04-03T17:27:44-07:00

Using IM 7.0.5-4 HDRI on Windows 10 64, when I create a single one line label, the "info:" (or the output image if I specify one) shows the expected height of a single line of text...

Code: Select all

magick label:"ABC" info:

label:ABC LABEL 26x15 26x15+0+0 16-bit sRGB 0.016u 0:00.015
When I run the same command and include a line break "\n" in the text, the "info:" shows a height approximately twice that of a the single line, again as expected...

Code: Select all

magick label:"ABC\nDEF" info:

label:ABC\nDEF LABEL 26x29 26x29+0+0 16-bit sRGB 0.016u 0:00.020
If I make the same single line label specifying a width with "-size", this command works as expected to output a label 100 pixels wide and 54 pixels high...

Code: Select all

magick -size 100x label:"ABC" info:

label:ABC LABEL 100x54 100x54+0+0 16-bit sRGB 0.031u 0:00.028
The issue of my concern occurs if I specify just a width and include a line feed within the text like this...

Code: Select all

magick -size 100x label:"ABC\nDEF" info:

label:ABC\nDEF LABEL 100x54 100x54+0+0 16-bit sRGB 0.078u 0:00.046
The output is only 54 pixels high, same as if the label was just a single line of text. Everything after the first line of text disappears. This will happen if the label text is included in the command with "label:"ABC\nDEF"" or if the label text is read from a multi-line file with "label:@mytext.txt".

There doesn't seem to be a problem if I specify both width and height with the "-size" setting, so the question is: Should this label contain just the first line of text when specifying only the width with "-size", or should a multi-line "label:" self-adjust for height and include the additional lines of text in this case?

Post Reply