Note this 'calculated' method is not good for generating the equivelent of an Append, as in that case the position depends on the position and width of every other image before it.
However in fixing the 't' and 'n' FX Expressions, I also allowed FX expressions to be able to access 'image attributes' from any other images in the list, including the images before it. What attributes it has access to is currently limited, but it is posible to craete a DIY append...
Hmmm, First looking at using the attribuets of the previous image...
Code: Select all
convert -size 20x10 xc:red -size 50x10 xc:green -size 30x10 xc:blue \
+repage -set page ']+%[fx:s[-1].w]' \
info:
xc:red[0] XC 20x10 0x0+20+0 16-bit sRGB 0.000u 0:00.219
xc:green[1] XC 50x10 0x0+20+0 16-bit sRGB 0.000u 0:00.080
xc:blue[2] XC 30x10 0x0+20+0 16-bit sRGB 0.000u 0:00.080
Well it worked, but the result is not right... the 'image' width is always 20! That is the first images 'w' value!
Oh okay a s[image_index] is not relative to the current image 's' but to the start of the list! okay.
Attempt two...
Code: Select all
convert -size 20x10 xc:red -size 50x10 xc:green -size 30x10 xc:blue \
+repage -set page '+%[fx:s[t-1].w]' \
info:
xc:red[0] XC 20x10 0x0+20+0 16-bit sRGB 0.000u 0:00.009
xc:green[1] XC 50x10 0x0+20+0 16-bit sRGB 0.000u 0:00.009
xc:blue[2] XC 30x10 0x0+50+0 16-bit sRGB 0.000u 0:00.009
that worked! though the image -1 (from t-1 for the first (zero index) image above) should be the 'last' image (image index -1) still gets the value from the first image -- that is a bug!
So lets try setting the page to the previous images 'x' offset plus that images with, setting that images x offset
Code: Select all
convert -size 20x10 xc:red -size 50x10 xc:green -size 30x10 xc:blue \
+repage -set page '+%[fx:s[t-1]page.x+s[t-1].w]+0' \
info:
xc:red[0] XC 20x10 0x0+20+0 16-bit sRGB 0.000u 0:00.010
xc:green[1] XC 50x10 0x0+40+0 16-bit sRGB 0.000u 0:00.000
xc:blue[2] XC 30x10 0x0+90+0 16-bit sRGB 0.000u 0:00.000
YES! replace info: with
-layers merge and you have a DIY append
(using relative position, and not calculating the exact position due to first image handling)
Code: Select all
convert rose: netscape: granite: \
+repage -set page '+%[fx:u[t-1]page.x+u[t-1].w]+0' \
-background DodgerBlue -layers merge +repage show:
Lesson: When using a image index, whether the image is u,v, or s does not matter! You much use 't' to specify a relative image index.
BUG: u[-1] is accessing the first image, not the last image as it is supposed to according to documentation.
Getting back to the OP. now that you have an programmed append, you can adjust the 'Y' offset, as you like. Of course finding the 'maximum height' of all the images in the one command is still a problem, but one that could be solved by generating a intermediate image that discovered the maximum height of all the images. Perhaps though more 'incremental' settings, and multiple setting runs.
Hmmmm get the maximum height!
Code: Select all
convert rose: netscape: granite: \
-set page '+0+%[fx:max(u[t-1].h,s.h)]' \
-set option:my:max_height '%[fx:u[n-1].page.y]' \
-format '%[my:max_height]\n' info:
So just set all image to that maximum offset, then reset all images but e.gif image ( image index 4, counting from zero) to 0, and set that image to the hight adjusted offset. You can then do the DIY append (preserving the vertical offset (using '%Y' instead of '%[fx:page.y]'
Code: Select all
convert a.gif b.gif c.gif d.gif.e.gif z.gif \
-set page '+0+%[fx:max(u[t-1].h,s.h)]' \
-set option:my:max_height '%[fx:u[n-1].page.y]' \
-set page '+0+%[my:max_height]' \
-set page '+0+%[fx:t==4?page.y-h:0]' \
-set page '+%[fx:u[t-1]page.x+u[t-1].w]+%Y' \
-background DodgerBlue -layers merge +repage show:
This works, and is VERY fast, except for the first (zero image) see below...
Note the last step could be combined with the second last.
PS: the above works, but seems to go wrong for image index 0. As
did not set the value into the first image. Again I don't know why.
In a similar way instead of using
Code: Select all
-set option:my:max_height '%[fx:u[n-1].page.y]' \
-set page '+0+%[my:max_height]'
I would have thought I could assign it directly using
Code: Select all
-set page '+0+%[fx:u[n-1].page.y]'
but all images except the last gets a value of zero!
This is all new territory and as such I am certain we are finding some new bugs.