How I can I add text to multiple line with largest possible font size?

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
bikash00789
Posts: 5
Joined: 2016-04-05T12:09:53-07:00
Authentication code: 1151

How I can I add text to multiple line with largest possible font size?

Post by bikash00789 »

https://github.com/bikash00789/MyFolder ... ne_fit.php

here I am able to change fontsize which is for single line? can someone help me for multiple line font resize, it should be best possible size according to the box or rectangle height and weight given.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How I can I add text to multiple line with largest possible font size?

Post by snibgo »

Can you show an example of what you mean? Perhaps you want something like ...
Image
... where each line occupies roughly the same width. In this example, the lines are also squished together.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How I can I add text to multiple line with largest possible font size?

Post by fmw42 »

You are using -annotate, which will only create an image for one line of text per usage of -annotate. If you want to create a text image with multiple lines automatically filling a box with the largest text, then see caption: at http://www.imagemagick.org/Usage/text/ and http://www.imagemagick.org/Usage/text/#caption_bestfit
Post Reply