Label best fit

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
emontezuma
Posts: 19
Joined: 2011-09-28T10:17:45-07:00
Authentication code: 8675308

Label best fit

Post by emontezuma »

Hi imagemagicker people.
I have te next string "MY NAME IS ELVIS MONTEZUMA" and I would like to generate a best fit pointsize with "Tahoma" font and size 100x100 but I cant.
I have read about the best fit label article but it seems work only with a single word label, for instance "Anthony", my label has several words.

Can anyone help me please?

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

Re: Label best fit

Post by fmw42 »

To use the best fit, you should not specify both width and height, but just one, say height and let it find the width to fit. Be sure the put quotes around your text

convert -size x100 -background lightblue -fill black -font tahoma label:"MY NAME IS ELVIS MONTEZUMA" result.gif

However, I am finding that there appears to be a bug, since it is not filling the height but some width at a default font size

see bug report at viewtopic.php?f=3&t=23184
Post Reply