FX Escapes now work exactly as originally defined.

Announcements pertaining to ImageMagick, or ImageMagick related software. This list is moderated. No discussions here, instead post to the users group instead.
Post Reply
User avatar
anthony
Posts: 8867
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

FX Escapes now work exactly as originally defined.

Post by anthony » 2011-03-28T19:22:45-07:00

The Latest version of IM, version 6.6.8-10 (a prelude to 6.6.9-0) allows you to use %p and %n and %[fx:t] and %[fx:n].

For example generate a range of images, then distort each image differently depending on the index...

Code: Select all

  convert rose:  -duplicate 29  -virtual-pixel tile \
          -distort SRT '0,0 1, 0, %[fx:w*t/n],%[fx:h*t/n]' \
          -set delay 10 -loop 0     rose_diagonal_roll.gif
Image

Here I use the image indexes to 'rotate' each image differently, and use -set with the image index to set a different 'pause delay' on the first image in the animation.

Code: Select all

  convert rose:  -duplicate 29  -virtual-pixel Gray \
          -distort SRT '%[fx:360*t/n]' \
          -set delay '%[fx:t==0?240:10]' -loop 0     rose_rotate.gif
Image

Without the use of image index calculations, the above would have required a external shell loop, to generate each frame individually, and a separate step to collect the frames to form the final animation. All of which slows down the whole process, instead of doing all in-memory.

The above examples are from IM Examples, Animated Distorts


Also this latest release also allows you to reference OTHER IMAGES via the %[fx:...] escape!

That is in an escape sequence 'u' now really does mean the first image, while 's' means the current image that is being looked at by the escape sequence.

Previously only one image was accessible, the 's' image, and as such its index 't' was uselessly set to zero. Also 'u==s' while 'v' did not exist.

With this release all the FX image indexing work as defined. So now.... 't=%p', 'n=%n' 'u' is always the first image, 'v' the second image, and the current image 's=u[t]'

I have no examples of using this ability to reference other images as yet, but possibilities include using a separate lookup table image or 'image map' to control the distortion in each frame of the animation. I look forward to see just what people use this for.

NOTE that as each image is 'distorted' in sequence, from first to last, the control map itself will also be distorted, and as such should be set to the last image so it does not change until all the other images have been distorted.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
http://www.imagemagick.org/Usage/

Post Reply