This is a note of caution for users who use -annotate. Annotating without setting a gravity may not produce what you want, since the default -gravity (-gravity none or +gravity) is not the same as -gravity northwest. This is something that I always thought until now was the same.
When I composite a text image onto a background, the default -gravity and -gravity northwest are the same.
Input:
Default:
Code: Select all
composite label:SomeText -geometry +10+10 \
rings.jpg gravity_default_pos.jpg
Northwest:
Code: Select all
composite label:SomeText -gravity northwest -geometry +10+10 \
rings.jpg gravity_northwest_pos.jpg
But when I use -annotate, they differ:
Default:
Code: Select all
convert rings.jpg \
-annotate +10+20 'SomeText' \
gravity.jpg
None:
Code: Select all
convert rings.jpg \
-gravity None -annotate +10+20 'SomeText' \
gravity_none.jpg
The two above are the same, but ...
Northwest:
Code: Select all
convert rings.jpg \
-gravity NorthWest -annotate +10+20 'SomeText' \
gravity_northwest.jpg
Both:
Code: Select all
convert rings.jpg \
-gravity NorthWest -annotate +10+20 'NorthWest' \
-gravity None -annotate +10+20 'None' \
gravity_text_pos.jpg
For reference see Anthony's page at
http://www.imagemagick.org/Usage/annota ... vity_image
and
http://www.imagemagick.org/Usage/annota ... avity_text
Where he states:
"The reason for the distinction is to ensure that IM text drawing remains compatible with other vector drawing image formats like the "SVG". These formats do not use gravity, so turning on gravity tells IM to follow the same rules as image placement when doing text drawing, rather than the vector graphics rules, involving the font 'baseline' and 'start' point of the text"
Code: Select all
Version: ImageMagick 6.9.7-0 Q16 x86_64 2016-12-18 http://www.imagemagick.org
Copyright: Copyright 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo fftw fontconfig freetype gslib jbig jng jp2 jpeg lcms lqr ltdl lzma openexr png ps rsvg tiff webp x xml zlib