scale text to fit

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

You can now create a label at a specific size!

See label: in IM exmaples
http://www.cit.gu.edu.au/~anthony/graph ... ext/#label

Just specify a -size for the label and don't give a -pointsize. IM will then find the best pointsize to fit that sized image.

This was added in version 6.2.5
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

Of course the words were not wrapped. You did not specify you wanted word wrapping too! Label will only us ethe text as given (including newlines now)
but will NOT word wrap.

If you give a size then that size is used in the result, and the font is scaled to fit that size. if only a pointsize is given the final label size is scaled to fit the text at that point size.

If you want to wrap the words as well. then add the fonts pointsize you want to use as well as at least the width of the final image, then use "caption:". That is the word wrapping text input generator.

Please read ALL of the IM example page...
http://www.cit.gu.edu.au/~anthony/graph ... ick6/text/
before continuing further with this discussion.

Here I have detailed ALL this information, including versions of IM where some of these options were added or changed.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

You need to add the -composite option to tell ImageMagick to composite the text over the image.
Post Reply