Page 1 of 1

possible bug in label in IM 6.4.2-10 or earlier

Posted: 2008-08-19T19:12:39-07:00
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

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

Posted: 2008-08-19T23:32:15-07:00
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.

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

Posted: 2008-08-20T00:47:44-07:00
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?

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

Posted: 2008-08-20T07:42:43-07:00
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

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

Posted: 2008-08-20T09:50:43-07:00
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

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

Posted: 2008-08-20T21:33:43-07:00
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