I can force text into the proper position using actual numeric values for X and Y in -annotate +X+Y, but I want to be able to compute the X and Y values (in my program) relative to the image size. I am using -gravity Northeast and NorthWest for both vertical and horizontal images of varying sizes. I want to be able to have the text inset a computed number of pixels from the edges of the image RELATIVE to the image size. In my testing, it seems that when using SouthEast, the X value I insert manually is relative to the right-hand edge of the image, which is counter-intuitive. Am I right?
I originally tried to set a margin from the left edge of the image, but that got strange results. So I tried using -gravity SouthEast -annotate +5+Y and got a right-hand margin of 5 pixels. When I changed to -annotate +7+Y I got a right-hand margin of 7 pixels. So I guess I don’t really understand the X values when using -gravity.
This is the full parameter string I am passing to mogrify:
mogrify in.jpg -format jpg -font "Rockwell" -weight ExtraBold -fill gold -pointsize 63 ^ -stroke black 13 -strokewidth 14 -gravity SouthEast -annotate +5+100 “text1” ^ -stroke none -gravity SouthEast -annotate +5+100 ”text1” E:\folders\parent\child1\in.jpg