Page 1 of 1

Annotate with FX expression using IM6

Posted: 2017-10-15T21:17:23-07:00
by GeeMack
Using IM 6.9.9-20 Q16 x64 HDRI with Windows 10, I get an unexpected result when running this command...

Code: Select all

convert -size 64x64 xc: xc: xc: -gravity northwest ^
   -pointsize 24 -annotate +0+0 "%[fx:t+1]" +gravity -crop 2x1@ out6.png
The command should create three canvases, annotate them with numbers 1, 2, and 3, then crop each canvas into halves. The actual output is these six panels (which I've appended for display)...

Image

Annotate is numbering the panels 1, 3, and 5 as if it's counting relative to the six images in the stack after the crop, even though the annotate operation occurs before the crop and should only affect the original three images.

If I run the same command with IM 7.0.7-8 by substituting "magick" for "convert", the output is as expected with the panels numbered 1, 2, and 3.

Re: Annotate with FX expression using IM6

Posted: 2017-10-15T21:43:11-07:00
by fmw42
I do not think annotate permits fx expressions in IM 6 for the text. However, it does allow escapes such as %w, but not %{fx:w]

Re: Annotate with FX expression using IM6

Posted: 2017-10-15T22:32:59-07:00
by GeeMack
fmw42 wrote: 2017-10-15T21:43:11-07:00I do not think annotate permits fx expressions in IM 6 for the text. However, it does allow escapes such as %w, but not %{fx:w]
I haven't found any descriptions of how "-annotate" handles FX expressions in IM6, but I have tested many variations, and pretty much everything I try seems to work as expected. Even back to version 6.7.7 on bash this would print "Test: 1256.64 200 72"...

Code: Select all

convert -size 400x100 xc: -gravity northwest \
   -annotate +0+0 "Test: %[fx:w*pi] %[fx:w>100?200:300] %[fx:resolution.x]" output.png
The documentation just below THIS link suggests FX expressions should work for at least "label:" and "caption:" since v6.3.2. I suppose the fact that it works for most expressions using "-annotate ..." and IM6 may be unintended.

Re: Annotate with FX expression using IM6

Posted: 2017-10-16T09:42:46-07:00
by fmw42
I stand corrected. If you have found that it works with fx expressions, then the issue is which "letters" it is coded for. Perhaps %[fx:t] is not coded whereas %[fx:w] does work. In that past, I had to ask that other letters be included in certain places, but I do not recall which letters or in which functions.