Page 1 of 1

How to do different -delay after last morph?

Posted: 2008-02-19T18:30:58-07:00
by casper
If I have 4 images that I want to morph, but delay longer after the last one (before it cycles back), how is that done?

I have it working with this hack, but this is needlessly writing an extra image.

convert \( -delay 60 -morph 1 file1.jpg file2.jpg file3.jpg file4.jpg \) \( -delay 120 file4.jpg \) out.gif


Extra credit:

Say you wanted to "morph 1" the first 3 images but "morph 5" between the 3rd and 4th image, how would that be done?

Thanks.

Re: How to do different -delay after last morph?

Posted: 2008-02-19T18:58:21-07:00
by fmw42
I have never used morph before, but have you tried:

convert \( -delay 60 -morph 1 file1.jpg file2.jpg \) \( -delay 120 -morph 5 file3.jpg file4.jpg \) out.gif

This should give you delay 60 for file 1 and 2 each as a frame and delay 120 for five frames between file 3 and 4.

Let us know if that works.

Re: How to do different -delay after last morph?

Posted: 2008-02-20T13:33:03-07:00
by casper
Nope... that has two problems...

* image #2 doesn't morph into image #3

* the morph from image #3 to image #4 is slowed down (due to the -delay 120), whereas what I want to do is make that morph happen at the same rate, but then linger on the last image for a while before the whole thing cycles again.

Re: How to do different -delay after last morph?

Posted: 2008-02-20T21:50:42-07:00
by anthony
So add a morph for between 2 and 3 also in parenthesis.

As the last image in the morphed sequence is the start for the next sequence you do not need to read it again. However you may need to remove the extra duplicate image between the morph sequences...

also you should read images BEFORE morphing them!!!

Code: Select all

convert file1.jpg
       \( +clone -set delay 60 file2.jpg -morph 1 -delete 0 \) \
       \( +clone -set delay 60 file3.jpg -morph 3 -delete 0 \) \
       \( +clone -set delay 60 file4.jpg -morph 5 -delete 0 \) \
       -layers Optimize out.gif
Note it is the delay setting for the first image that sets the delay of the generated morphed image (I think, can someone verify).

Also note that while I optimize the results, unless parts of the image don't change color a morph does not optimize very well.

The -morph operator is more like a repeated -blend operation
See http://imagemagick.org/Usage/compose/#blend

A True morph not only involves a color blend, but also a spatial distortion, generally defined using two related meshes of distortion control points, See the problem 'Xmorph'.

This type of morph is almost within the graph of IM's general distortion operator, only requiring a mesh distortion method to be added (I haven't had time to do this yet).

For reversing a existing animation, see IM examples Animation modifiactions, Reversing
http://imagemagick.org/Usage/anim_mods/#reverse