possible bug in label in IM 6.4.2-10 or earlier

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
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

possible bug in label in IM 6.4.2-10 or earlier

Post by fmw42 »

I have some scripts that generate graphs. Part of the graph is a label for the vertical axis which I have been making successfully for quite some time. But today I noticed that the part of the graph that is the vertical axis label is now getting cropped a bit on the right edge. Something has changes in one of the later releases. As of IM 6.4.2-10 is where I caught this (Q16 Mac OSX Tiger).

(For example compare the old graphs at http://www.fmwconcepts.com/imagemagick/plm/index.php vs the new ones generated today at http://www.fmwconcepts.com/imagemagick/curves/index.php).

Here is the part that is now not quite working:

convert -background white -fill black -font Arial \
-pointsize 12 -gravity center label:'o\nu\nt\np\nu\nt' output.png


You will see that the right edge is cropped/trimmed too much, now. But in earlier releases (don't know where it changed) it was working fine.

If something has changed and this is not a bug, can you point out an easy way to avoid the trim without having to determine the size of this image first. I would still like to use label as the IM function to create it as it is supposed to create an image just large enough to hold the text without trimming away any of the text.

Thanks.

P.S. I have not changed any of my fonts since it was working before.


Fred
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: possible bug in label in IM 6.4.2-10 or earlier

Post by anthony »

Actually I have reported this a number of times already!

Try this.

Code: Select all

  convert label:'Anthony!'  x:
The label is trimmed on the right by one pixel causing the exclamation mark to 'disappear'.

Adding a space on the end fixed, what should not have neededfixing.

Code: Select all

  convert label:'Anthony! '  x:
It is not font or font size specific, all label output are short one pixel.

Actually I think the label itself is the right size, but the right edge is given a
background overlay, trimming the drawn glyph content, rather than the label size.

This may also have been caused by a update in the freetext library, rather than in IM itself.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug in label in IM 6.4.2-10 or earlier

Post by fmw42 »

Easy to add one space character for horizontal text, but what can I do for vertical text as in my example.


Do you know in what release this first started?
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: possible bug in label in IM 6.4.2-10 or earlier

Post by el_supremo »

label:'o \nu \nt \np \nu \nt ' puts a space down the right side. If there's more space than you need, as an interim measure you could trim it and then pad it out.

Pete
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug in label in IM 6.4.2-10 or earlier

Post by fmw42 »

el_supremo wrote:label:'o \nu \nt \np \nu \nt ' puts a space down the right side. If there's more space than you need, as an interim measure you could trim it and then pad it out.

Pete

Thanks Pete. This seems to work fine.

convert -background white -fill black -font Arial \
-pointsize 12 -gravity center label:'o \nu \nt \np \nu \nt ' -trim output.png


Fred
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: possible bug in label in IM 6.4.2-10 or earlier

Post by anthony »

el_supremo wrote:label:'o \nu \nt \np \nu \nt ' puts a space down the right side. If there's more space than you need, as an interim measure you could trim it and then pad it out.
Actually it doesn't. what it does is increase the line length, so increase the label width, you really only need it on the widest character.

I would class this as a stop gap measure until the cause of the problem is fixed.

PS: I would prefer to use a -gravity center with verticall text like this as it would line up the individual characters
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply