I am working at populating some text on a Kindle cover. At present convert
seems to be taking caption:
to be the beginning of the text I've rendered. The present invocation reads:
convert kindle-cover.jpg -font "Georgia" -pointsize 150 -size 320x -gravity South -annotate +0+100 caption:'C.J.S. Hayward' workbench.jpg
The text is, as desired, centered near the bottom of the image, and the font size isn't perfect, either. However, I have tried several invocations like caption:
, -caption
, etc., and I don't seem to be getting caption-like behavior.
Although not relevant to the author name on the cover, I want to allow titles that show graceful caption-like behavior, including soft wrapping and dynamic resizing if the title the user entered needs to be wrapped.
What can / should I be doing differently to get caption, instead of label, behavior?
Thanks,
--UPDATE-- @Bonzo suggested I provide my ImageMagick version. The version is:
Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-07-31 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff wmf x xml zlib
The machine is running the current version of Linux Mint.
You should not use both -annotate and caption: in the same command line in ImageMagick. Try using one or the other. For example here are 3 different methods: -annnotate, label: and caption: with a smaller font size. -annotate write directly on the image. Both label: and caption: create their own separate image that needs to be composited onto your original image.
convert kindle-cover.jpg -font "Georgia" -pointsize 72 -gravity south -annotate +0+100 'C.J.S. Hayward' workbench.jpg
convert kindle-cover.jpg \( -size 320x -background none -font "Georgia" -gravity south label:'C.J.S. Hayward' \) -gravity south -geometry +0+100 -compose over -composite workbench.jpg
convert kindle-cover.jpg \( -size 320x -pointsize 72 -background none -font "Georgia" -gravity south caption:'C.J.S. Hayward' \) -gravity south -geometry +0+100 -compose over -composite workbench.jpg
EDIT: The latter will wrap, but not the first two. So you need to set the -size 320x to the width you want. As bonzo said, in IM 6, you would need to test your input image size and specify some percentage of that which you want to use. For example, you would have to run it this way in IM 6. Lets say you want the text width to be 1/3 of your image width. In unix syntax, you would do:
ww=`convert kindle-cover.jpg -format "%[fx:w/3]" info:`
convert kindle-cover.jpg \( -size ${ww}x -pointsize 72 -background none -font "Georgia" -gravity south caption:'C.J.S. Hayward' \) -gravity south -geometry +0+100 -compose over -composite workbench.jpg
In IM 7, you could do
magick kindle-cover.jpg \( -size "%[fx:w/3]x" -pointsize 72 -background none -font "Georgia" -gravity south caption:'C.J.S. Hayward' \) -gravity south -geometry +0+100 -compose over -composite workbench.jpg