The real problem is that currently IM uses -gravity for BOTH positioning, and justification at that position.
However there is a way out of this problem, look at -draw with gravity. The examples for this is a little odd as it actually even pre-dates IM Examples!
IM Examples, Annotating, Text Positioning with Rotation
http://www.imagemagick.org/Usage/annota ... t_rotation
Until we get a proper justification setting for positioning both text and images on another image, that is the bast that can directly.
Indirectly is another matter! You can
- render your text into a separate image, with whatever justification, (gravity) you want in that box
- Now distort that image using SRT, with scale, rotation and more importantally translation to place the text where you want
- and finally 'layer' the image onto the background.
The only problem with this technique is that you can't position or translate the image with 'gravity' you need to do this yourself by using some equations in the distort string.
I am sure a complete textual/image positioning system could be worked out using SRT distortion.
http://www.imagemagick.org/Usage/distort/SRT
It's arguments was designed with full positioning controls in mind, though only with absolute offsets. However as you can use % escapes you can make your own offsets, relative to the original image, or with some extra work even relative to some other (final destination) image. Also unlike other methods (direct compose) the positioning can be to a sub-pixel level.