Page 1 of 1

Font size problem

Posted: 2009-07-18T14:55:16-07:00
by yamaguchih
Hi, I'm using ImageMagick to annotate text to an image through "bands" and "brands".
The difference is that "bands" don't overwrite the image, but attach a band of text underneath.
"Brands" on the other hand are free to overwrite the image and they overlay a text brand on top
of the image.

I'm taking in a masterfile, around 4000 by 3000 each, and converting them to 800x800 and 1200x1200 (but these dimensions should be flexible)

I at first ran without the "-pointsize" option but the problem is I am using these on images that are
4000+ pixels wide and ImageMagick seems to decide to use pt. 13 font even when the dimension is that
huge (and renders the text unreadable, obviously.) If I do specify a pointsize, however, it overflows
the image.

Is there a way to make IM's "caption" use text large enough so that it is visible (not necessarily legible)
even when seeing a zoomed-out version of a 4000px image, and also make it word wrap properly with that
fontsize?

Here is the "band" command I'm using: ({} are variables in my web application)

Code: Select all

convert {inputFile} -background {bgColor} -fill {fgColor} -pointsize {fontsize} -gravity center -size {imageWidth(NOT the master width--either 800 or 1200 in current case}x caption:{bandtext} -append {outputFile}
And here is the "brand" command: ({} are variables}

Code: Select all

convert -background {bgColor} -fill {fgColor} -pointsize {fontsize} -gravity center -size {imageWidth(same note applies}x -caption:{brandText} +size {inputFile} +swap -gravity south -composite {output}
Any help would be greatly appreciated.

Re: Font size problem

Posted: 2009-07-19T19:03:58-07:00
by anthony
I do not follow you 'band' and 'brand' definations. Some small examples may help.

However I think I understand the problem.

If you do not specify a point size but BOTH width and height limits THEN and only then IM caption: will attempt to find the best size to FILL the space given with word wrap.

The caption: image creator always requires a -size width, as part of its normal processing. BUT you then either must specify a pointsize or a height. If both are not specified the default pointsize will be used. That is what you are seeing.

See IM Examples, Caption Best Fit
http://www.imagemagick.org/Usage/text/#caption_bestfit