Page 2 of 3

Re: Text rendering: label overflows

Posted: 2013-05-10T10:26:59-07:00
by qubodup
fmw42 wrote:
It has to pick one or the other of W or Height to fit. You cannot fit both without one font size and without distorting the text in the other dimension.
Yes, that's what I wish to achieve. I am not trying to get this (GIMP MOCKUPS):
Image
Image
(eew) :)

I'm at ImageMagick 6.8.5-3 2013-04-27 Q16.

Code: Select all

convert -size 300x100 -gravity center label:"Test" label4.png
Image
---

Code: Select all

convert -size 100x300 -gravity center label:"Test:" label5.png
Image

Re: Text rendering: label overflows

Posted: 2013-05-10T10:35:24-07:00
by fmw42
You cannot best fit both dimensions, so one or the other will be used.

These two examples do not look correct
convert -size 200x20 label:"T_T" label7.png
Image

convert -size 200x20 label:"T____________________________________T" label8.png
Image

I do not know how label decides which dimension to best fit when specifying both W and H but no pointsize is specified. I suppose that it should check to see which one will not cut-off the text and not leave too much white space. In this sense, perhaps there is a bug or it needs an enhancement to test both ways and see which is best.


This is the best way to handle it, for now, until it is enhanced/fixed - pick one or the other dimension.
convert -size x20 label:"T_T" label7a.png
Image


convert -size x20 label:"T____________________________________T" label8a.png
Image

Re: Text rendering: label overflows

Posted: 2013-05-10T10:39:15-07:00
by qubodup
fmw42 wrote:You cannot best fit both dimensions, so one or the other will be used.
It seems to be impossible for me to convince you that I understand this?

Re: Text rendering: label overflows

Posted: 2013-05-10T10:41:13-07:00
by fmw42
No, on the contrary, you have convinced me that there is a bug or needs an enhancement according to the last examples you had me run.

Label should be able to tell which dimension to best fit so as to fill one dimension without over or under filling the other. The first two examples in my last post convinced me that you have found a problem.

Re: Text rendering: label overflows

Posted: 2013-05-10T17:13:15-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.8.5-7 Beta available by sometime tomorrow. Thanks.

Re: Text rendering: label overflows

Posted: 2013-05-11T18:26:02-07:00
by fmw42
6.8.5-7 Beta

I am getting strange results from show:.

Compare these:

green letters, horizontal scaling and transparent on the right:
imb convert -size 200x100 label:"T_T" show:

looks fine:
imb convert -size 200x100 label:"T_T" x:

Re: Text rendering: label overflows

Posted: 2013-05-12T04:18:37-07:00
by qubodup
My netbook with Arch Linux 32 bit had im 6.8.4-6 2013-04-03 Q16, so I tested some code on it.

Code: Select all

convert -size 300x100 -gravity center label:"Test" label4.png
Image
---

Code: Select all

convert -size 100x300 -gravity center label:"Test:" label5.png
Image

Then I upgraded to 6.8.5-3 2013-04-27 Q16.

Code: Select all

convert -size 300x100 -gravity center label:"Test" label4.png
Image
---

Code: Select all

convert -size 100x300 -gravity center label:"Test:" label5.png
Image
fmw42 wrote: imb convert -size 200x100 label:"T_T" show:
imb convert -size 200x100 label:"T_T" x:
What is the "imb " part? I recommend using the "code" bbcode tags for clarity when quoting code. Here's screenshots of what got displayed in 6.8.4-6:
show: Image
x: Image

And in 6.8.5-3 2013-04-27 Q16.

show: Image
x: Image

So I seem to be unable to reproduce what you described. (The font size changed though.) If nobody else can reproduce, perhaps you can post a screenshot of the displayed result.

Re: Text rendering: label overflows

Posted: 2013-05-12T05:35:48-07:00
by magick
We can reproduce Fred's problem, its related to the show delegate. Fred, edit delegates.xml and change miff to png for the "show" delegate. In the mean-time we'll come up with a patch for the problem.

The "imb" command is just Fred's short cut for ImageMagick Beta.

Now the question is, given ImageMagick 6.8.5-7 Beta, does label: have any more bugs?

Re: Text rendering: label overflows

Posted: 2013-05-12T21:33:06-07:00
by anthony
Okay Quick tests show label: auto-size is now working

as is selecting a specific point size

But without any size or pointsize setting I am still getting a 'small' pointsize rather than the default of 12

Code: Select all

convert -version
Version: ImageMagick 6.8.5-7 2013-05-13 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP Modules
Delegates: autotrace bzlib djvu mpeg fftw fontconfig freetype gslib jng jp2 jpeg lcms lqr pango png ps rsvg tiff wmf x xml zlib

convert label:"what what what what what what what what" -print '%[label:pointsize]\n' -identify show:
10.71875
label:what what what what what what what what=>what what what what what what what what LABEL 232x15 232x15+0+0 16-bit sRGB 0.010u 0:00.019
and label image is longer than the expected font, producing extra space on the right. Second bug was not fixed

Re: Text rendering: label overflows

Posted: 2013-05-13T02:23:09-07:00
by qubodup
In IM6 r12270 on Arch Linux 64bit, the spacing seems to work for me. See below for an explanation why the font family is different.

Code: Select all

./convert -size 200x20  label:T_T test.png
Image
---

Code: Select all

./convert -size 200x20  label:T____________________________________T testlong.png
Image

The font family seems strange, compared to the previous tests. This is probably because I did not install the compiled svn version but run from IM6/utilities/. Here are the messages I get: http://codepad.org/BEPzcvhy . It seems to be no issue if I specify a font.

Re: Text rendering: label overflows

Posted: 2013-05-13T04:41:38-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.8.5-7 Beta available by sometime tomorrow. Thanks.

Re: Text rendering: label overflows

Posted: 2013-05-13T23:13:09-07:00
by anthony
I can not see any more problems. Thanks.

Re: Text rendering: label overflows

Posted: 2013-05-21T06:58:40-07:00
by jdstruck
Upon reading this thread, it would seem that this issue was resolved, however when I attempt to create a label, I am still seeing overflow, running 6.8.5-6 2013-05-07 Q16 on windows xp 32. If I set both height and width in the -size option, it will only "best fit" to height, and overflow to the sides. For my purposes, I need to create a label of an exact size, so just setting one of the variables is not an option. For now, I've been setting a -pointsize, as my typical label text is a set number of characters, however on occasion I will need to write more, and do not want to have to tweak the -pointsize every time. Any ideas?

Example:

Code: Select all

convert -size 225x150 -background white -fill black -font Arial -gravity center label:testing testing.jpg
Image

Re: Text rendering: label overflows

Posted: 2013-05-21T07:18:39-07:00
by qubodup
jdstruck wrote:6.8.5-6
As far as I followed this thread, 6.8.5-7 still had issues.

Re: Text rendering: label overflows

Posted: 2013-05-21T07:25:37-07:00
by jdstruck
As far as I followed this thread, 6.8.5-7 still had issues.
Ahh sorry I did not read as carefully as I should have.