Automatically resize caption font size

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
qaz123
Posts: 5
Joined: 2011-05-08T10:32:24-07:00
Authentication code: 8675308

Automatically resize caption font size

Post by qaz123 »

Is there a way to keep the caption formatting (ie. kerning, interline-spacing) as well as the page size (ie.500x400) but allow the font to automatically resize so that word wrap does not cut off the text at the bottom?

Also, is it possible to set a certain pointsize if no overflow happens and allow automatic pointsize adjustments when the texts do not fit in the image?

Thanks!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Automatically resize caption font size

Post by anthony »

Yes specify the height as well as the normal width of the caption.
Without a pointsize being set (use +pointsize to unset if you already set it previously) caption (like lables) will resize.

See IM examples, Text to Image, Caption, Best Fit Caption
http://www.imagemagick.org/Usage//text/#caption_bestfit

NOTE: label and caption resize is slower as internally IM does a trial and error match to find a pointsize that fits (according to the font information).

PS: currently gravity is used for justification! I hope to get gravity and justification separated in IMv7
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply