How to change delay of certain images in a sequence

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
synjuice

How to change delay of certain images in a sequence

Post by synjuice »

For example I have 3 images and i want to do morphing between them.

Code: Select all

convert -delay 10 1.jpg 2.jpg 3.jpg -clone 0 -morph 3 -delete 0 output.gif
But my goal is to make delay bigger than 10 on these images.

I'm new in ImageMagick so i can't see any other way than to

Code: Select all

+adjoin output.gif output_%02d.gif
and then convert it to animation by setting paticular delay for every image in sequence. I find it very complex way and i'd be grateful if you help me with that. Thank you!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to change delay of certain images in a sequence

Post by fmw42 »

synjuice

Re: How to change delay of certain images in a sequence

Post by synjuice »

I've already tried to find an answer in these tutorials. But as far as i get it there's no solution for my problem. There is actually one example for 2 images but there're to many swaps and etc. It also doesn't work when i try to repeat each step.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to change delay of certain images in a sequence

Post by fmw42 »

I am not an expert on morphing, but

first: why do you not just change the delay from -delay 10 to -delay 20
second: why do you have a -delete 0 at the end?
third: did you try doing a search on this forum for "morph".

Perhaps this article will help:
viewtopic.php?f=1&t=10689&p=33932&hilit=morph#p33932


Also see:
http://www.imagemagick.org/Usage/anim_mods/#morph
synjuice

Re: How to change delay of certain images in a sequence

Post by synjuice »

fmw42 wrote:first: why do you not just change the delay from -delay 10 to -delay 20
Well that delay would make every frame to pause for 20, but i don' wand transition frames to pause that much.
fmw42 wrote:second: why do you have a -delete 0 at the end?
Because i need to make morphing between the last image in a sequence and the first one.
fmw42 wrote: third: did you try doing a search on this forum for "morph". Perhaps this article will help: ...
fmw42 wrote:
Yeah, i've seen that. but this one only gives different number of morphing frames. I don't have problems with that.
synjuice

Re: How to change delay of certain images in a sequence

Post by synjuice »

Well, here's an example of that what i want to do:

Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to change delay of certain images in a sequence

Post by fmw42 »

I decomposed you animation to make the following 3 images. I also saw that it had 4 tween frames. So I reproduced your animation as follows:

Image

Image

Image


I used the following to make the animation:

convert catsA.gif \
\( +clone -set delay 10 catsB.gif -morph 4 -delete 0 \) \
\( +clone -set delay 10 catsC.gif -morph 4 -delete 0 \) \
\( +clone -set delay 10 catsA.gif -morph 4 -delete 0 -set delay 0 \) \
-loop 0 -layers Optimize cats_new10.gif

Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to change delay of certain images in a sequence

Post by fmw42 »

Probably the delay 10 was being ignored for a large image which takes some time to display, but longer than you want for a smaller image. Try increasing the delay 10 to a larger value.

Again I am no expert and just experimented until I got it to work. I would look at the following:

http://www.imagemagick.org/Usage/anim_basics/
http://www.imagemagick.org/Usage/anim_opt/
http://www.imagemagick.org/Usage/anim_mods/
http://www.imagemagick.org/Usage/anim_mods/#morph
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How to change delay of certain images in a sequence

Post by anthony »

The example you want is present in the morphing example.
NOTE morph will insert X pictures between each original image frame given. You can in fact just give all the images and apply morph to generate the intermediate morphing frames

Code: Select all

   convert  catA.gif catB.gif catC.gif catA.gif -morph 9 animation.gif
however as you noted -morph currently just uses the delay given in the first image of each morphing sequence as the delay for the inserted morphed images. I would like to change that so the current global -delay setting will be used instead, but that may involve a internal API library change.

The solution is after morphing, pull out the images you want to pause at and change there delays. It is the same as pulling out individual frames to draw on just the one frame.

Code: Select all

convert  -delay 10 catA.gif catB.gif catC.gif catA.gif -morph 9 \
       \( -clone 0  -set delay 100 \) -swap 0,-1 +delete \
       \( -clone 10  -set delay 100 \) -swap 10,-1 +delete \
       \( -clone 20  -set delay 100 \) -swap 20,-1 +delete \
       +delete  animation.gif
Each originla image, in the new position they are is after inserting 9 morphing frames is cloned, a new delay set, and swapped back into its original position to replace the frame with the wrong delay.

the last frame is just deleted as it is a copy of the frist frame. Actually you may like to delete the frist frame in case the animation is ment to 'stop' at the end.

ALL these are in IM Examples, Animation Modifications, you are just skipping over the example you want (drawing)!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply