Problem using -set delay

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?".
marclallen

Problem using -set delay

Post by marclallen »

Hello,

My web hosting company updated to 6.6.3 recently, and suddenly, some of my IM code started generating bad GIFs.

Basically, I create several frames, which delay 5 seconds, the morph to the next frame in about .3 seconds overall.

The convert command line is enormous.. here is what I think is relevant, but I can provide the whole thing if need be.

"convert ..... -delay 500 ....... " and add in a bunch of images (which I delete later) and using a PHP program I do things like:

"\( -clone 0 \) \( -clone 0 -clone 1 -morph 3 -delete 0,4 -set delay 10 \)"

And I do the above over and over again. But, with the code update, suddenly, I have a 5 second delay between ALL frames.

This code used to work, now it doesn't.

Did something change?

Example GIF:

Image

(If that all shows correctly, with fast animation between frames, then both IE8 and FF is failing me!)

Thanks,

Marc
marclallen

Re: Problem using -set delay

Post by marclallen »

More info... the previous version was 6.3.9.

I read in the release notes (the version slips my mind, but it was between these) about the -set option no longer being delayed in processing or something like that.

But, I didn't understand what it meant.

Anyone?

Thanks,

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

Re: Problem using -set delay

Post by fmw42 »

I probably cannot help, but is this the changelog entry?


2008-05-15 6.4.1-4 Cristy <quetzlzacatenango@image...>
Interpreting the -set option is no longer delayed.
marclallen

Re: Problem using -set delay

Post by marclallen »

Yes! That was the entry.

I am wondering if that is changing how my command is being processed.
marclallen

Re: Problem using -set delay

Post by marclallen »

Ok.. I guess I'll try to put together a sample that has the problem. I was hoping there'd be an easy and quick answer.

Could someone at least tell me the meaning of the release note mentioned above?

Thanks,

Marc
marclallen

Re: Problem using -set delay

Post by marclallen »

Ok.. Sample:

convert -size 160x46 xc:'rgb(0, 0, 0, 1.0)' -size 160x46 xc:'rgb(0, 255, 0, 1.0)' -delay 500 \( -clone 0 -clone 1 -morph 3 -set delay 10 \) -delete 0-1 -layers Optimize tp.gif

Image

Why doesn't this animate at .1 seconds per frame?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem using -set delay

Post by fmw42 »

I am not an expert on animation and cannot explain the change to -set, but I am not sure I understand why you have added -delay 500? Do you want an initial delay of 500 and then the rest to animate at 10? Or do you just want the animation at 10. If the latter, just do

convert -delay 10 -size 160x46 xc:'rgb(0, 0, 0, 1.0)' -size 160x46 xc:'rgb(0, 255, 0, 1.0)' -morph 3 -layers Optimize tp.gif

otherwise, try this to get a delay of 50 at the beginning and end and 30 for the rest.


convert -respect-parenthesis \
\( -delay 500 -size 160x46 xc:'rgb(0, 0, 0, 1.0)' -size 160x46 xc:'rgb(0, 255, 0, 1.0)' \) \
\( -delay 30 -clone 0 -clone 1 -morph 3 \) \( -clone 1 \) -delete 1 -layers Optimize tp.gif

or

convert -respect-parenthesis \
\( -delay 500 -size 160x46 xc:'rgb(0, 0, 0, 1.0)' -size 160x46 xc:'rgb(0, 255, 0, 1.0)' \) \
\( -clone 0 -clone 1 -morph 3 -set delay 30 \) \( -clone 1 \) -delete 1 -layers Optimize tp3.gif

The problem may have been the -respect parenthesis, but I don't see how your method works, because it would set all frames to 10 including the first and last, if I understand correctly.
marclallen

Re: Problem using -set delay

Post by marclallen »

Oh.. sorry, yes.. I can see where the -delay 500 would be confusing.

See, I have several frames.... say 10. I want each frame to show for 5 seconds, then quickly morph to the next frame. My example didn't show that.

So, I use the -delay 500 to set the base frame delay, and then use -set delay during the morph to make it quick.

I can try putting a new -delay at the beginning on the stack. I think I tried that before and it didn't work, because it was a global setting, but I can try again. Maybe it's local to the stack, now.

My method works (or worked) because, if I understand correctly, the -set delay only affects the images already in the current stack, not all images. So, it should only affect images in the parenthesis. But, as it is, it's like the -set delay isn't there at all. I'm not familiar with -respect-parenthesis, but I didn't need it before.

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

Re: Problem using -set delay

Post by fmw42 »

respect-parenthesis (or respect-parentheses) is supposed to enforce that settings in the parentheses are used only in the parentheses. it is somewhat new. see http://www.imagemagick.org/Usage/basics/#controls and http://www.imagemagick.org/script/comma ... arentheses
marclallen

Re: Problem using -set delay

Post by marclallen »

Interesting. But, there must be something about delays...

I tried this:
convert -respect-parentheses -size 160x46 xc:'rgb(0, 0, 0, 1.0)' -size 160x46 xc:'rgb(0, 255, 0, 1.0)' -delay 500 \( -delay 10 -clone 0 -clone 1 -morph 3 \) -delete 0-1 -layers Optimize tp2.gif
And still get 5 seconds between frames. You would think that the -delay 10 would change the delay, but it doesn't. Maybe when the image stack gets promoted to the top, it has it's delay changed?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem using -set delay

Post by fmw42 »

yes, I did the same and got your same results. But I think it is because when you clone the images and then delete the original, the -set resets the delay of the clones to 10 rather than keeping the 500. That is what I was trying to say before about not thinking your approach made sense to me.

Why it might have worked before is beyond me.
marclallen

Re: Problem using -set delay

Post by marclallen »

(Accidently posted in the wrong topic!)

Because I've simplified the problem to show the -set delay not working.

In reality, I had a \( -clone 0 \) before the stack with the -set delay 10. This cloned image was not deleted and had the full 5 seconds.

Marc
marclallen

Re: Problem using -set delay

Post by marclallen »

fmw42 wrote:
marclallen wrote:Because I've simplified the problem to show the -set delay not working.

In reality, I had a \( -clone 0 \) before the stack with the -set delay 10. This cloned image was not deleted and had the full 5 seconds.

Marc

The above is a reply to the wrong topic. But I understand. Perhaps you need to provide your proper command that worked before and an example or change your example to something that will demonstrate your real problem.
This does demonstrate my real problem.

According to the documentation, -set delay changes all the images on the stack. Therefore, the image generated should have 10ms delays between frames during the morph. It doesn't. In the second example, I have -delay 10 clearly in the parentheses, yet the animation is still 5 seconds per frame. If someone can tell me why it doesn't or where I am misunderstanding, I will be able to go back and correct the original problem.

The reason I simplified it is because the original is below, but I didn't think people would want to mess with it.

convert -background none -stroke none -fill white \( -size 160x46 xc:'rgb(0, 0, 0, 1.0)' -alpha off -size 160x24 -gravity west label:'Kazoo' -gravity none -geometry +0+2 -composite -size 160x18 -gravity west label:'Old And In The Way' -gravity none -geometry +0+28 -composite \) \( -size 160x46 xc:'rgb(0, 0, 0, 1.0)' -alpha off -size 160x24 -gravity west label:'Kazoo' -gravity none -geometry +0+2 -composite -size 160x18 -gravity west label:'Groupies: 70,660' -gravity none -geometry +0+28 -composite \) -delay 500 -pointsize 10 -alpha off \( base/base_gh3_xbox_guitar.png -clone 0 -geometry +100+2 -composite -draw "text 287,23 '5'" -draw "text 287,33 '1'" -draw "text 287,43 '0'" -draw "text 306,23 '84'" -draw "text 306,33 '81'" -draw "text 309,43 '2'" -draw "text 328,23 '90'" -draw "text 328,33 '59'" -draw "text 331,43 '2'" -draw "text 350,23 '77'" -draw "text 350,33 '26'" -draw "text 353,43 '0'" \) \( base/base_aerosmith_xbox_guitar.png -clone 1 -geometry +100+2 -composite -draw "text 287,23 '0'" -draw "text 287,33 '0'" -draw "text 287,43 '0'" -draw "text 309,23 '9'" -draw "text 309,33 '9'" -draw "text 309,43 '6'" -draw "text 328,23 '40'" -draw "text 328,33 '22'" -draw "text 331,43 '0'" -draw "text 350,23 '34'" -draw "text 353,33 '4'" -draw "text 353,43 '0'" \) \( base/base_ghwt_xbox_guitar.png -clone 0 -geometry +100+2 -composite -draw "text 287,23 '0'" -draw "text 287,33 '0'" -draw "text 287,43 '0'" -draw "text 306,23 '16'" -draw "text 306,33 '16'" -draw "text 306,43 '11'" -draw "text 328,23 '49'" -draw "text 328,33 '15'" -draw "text 331,43 '2'" -draw "text 346,23 '119'" -draw "text 350,33 '41'" -draw "text 353,43 '1'" \) \( base/base_ghwt_xbox_bass.png -clone 1 -geometry +100+2 -composite -draw "text 287,23 '0'" -draw "text 287,33 '0'" -draw "text 287,43 '0'" -draw "text 309,23 '1'" -draw "text 309,33 '1'" -draw "text 309,43 '0'" -draw "text 328,23 '31'" -draw "text 328,33 '26'" -draw "text 331,43 '7'" -draw "text 350,23 '85'" -draw "text 350,33 '64'" -draw "text 353,43 '2'" \) \( base/base_ghwt_xbox_drum.png -clone 0 -geometry +100+2 -composite -draw "text 284,23 '84'" -draw "text 284,33 '50'" -draw "text 287,43 '3'" -draw "text 306,23 '18'" -draw "text 309,33 '0'" -draw "text 309,43 '0'" -draw "text 331,23 '0'" -draw "text 331,33 '0'" -draw "text 331,43 '0'" -draw "text 353,23 '0'" -draw "text 353,33 '0'" -draw "text 353,43 '0'" \) \( base/base_ghwt_xbox_vocals.png -clone 1 -geometry +100+2 -composite -draw "text 284,23 '14'" -draw "text 284,33 '12'" -draw "text 287,43 '0'" -draw "text 306,23 '18'" -draw "text 309,33 '6'" -draw "text 309,43 '0'" -draw "text 331,23 '0'" -draw "text 331,33 '0'" -draw "text 331,43 '0'" -draw "text 353,23 '0'" -draw "text 353,33 '0'" -draw "text 353,43 '0'" \) \( base/base_metallica_xbox_guitar.png -clone 0 -geometry +100+2 -composite -draw "text 287,23 '2'" -draw "text 287,33 '1'" -draw "text 287,43 '0'" -draw "text 309,23 '8'" -draw "text 309,33 '8'" -draw "text 309,43 '5'" -draw "text 328,23 '34'" -draw "text 328,33 '16'" -draw "text 331,43 '0'" -draw "text 350,23 '37'" -draw "text 353,33 '8'" -draw "text 353,43 '0'" \) \( base/base_metallica_xbox_bass.png -clone 1 -geometry +100+2 -composite -draw "text 287,23 '3'" -draw "text 287,33 '3'" -draw "text 287,43 '0'" -draw "text 309,23 '0'" -draw "text 309,33 '0'" -draw "text 309,43 '0'" -draw "text 331,23 '9'" -draw "text 331,33 '5'" -draw "text 331,43 '0'" -draw "text 350,23 '47'" -draw "text 350,33 '26'" -draw "text 353,43 '2'" \) \( base/base_metallica_xbox_drum.png -clone 0 -geometry +100+2 -composite -draw "text 287,23 '5'" -draw "text 287,33 '4'" -draw "text 287,43 '0'" -draw "text 309,23 '0'" -draw "text 309,33 '0'" -draw "text 309,43 '0'" -draw "text 331,23 '0'" -draw "text 331,33 '0'" -draw "text 331,43 '0'" -draw "text 353,23 '0'" -draw "text 353,33 '0'" -draw "text 353,43 '0'" \) \( base/base_greatesthits_xbox_guitar.png -clone 1 -geometry +100+2 -composite -draw "text 287,23 '0'" -draw "text 287,33 '0'" -draw "text 287,43 '0'" -draw "text 309,23 '5'" -draw "text 309,33 '5'" -draw "text 309,43 '5'" -draw "text 328,23 '29'" -draw "text 328,33 '24'" -draw "text 331,43 '1'" -draw "text 350,23 '42'" -draw "text 353,33 '8'" -draw "text 353,43 '0'" \) \( base/base_greatesthits_xbox_bass.png -clone 0 -geometry +100+2 -composite -draw "text 287,23 '0'" -draw "text 287,33 '0'" -draw "text 287,43 '0'" -draw "text 309,23 '0'" -draw "text 309,33 '0'" -draw "text 309,43 '0'" -draw "text 331,23 '9'" -draw "text 331,33 '9'" -draw "text 331,43 '6'" -draw "text 350,23 '48'" -draw "text 350,33 '28'" -draw "text 353,43 '0'" \) \( base/base_greatesthits_xbox_drum.png -clone 1 -geometry +100+2 -composite -draw "text 287,23 '1'" -draw "text 287,33 '1'" -draw "text 287,43 '0'" -draw "text 306,23 '16'" -draw "text 309,33 '4'" -draw "text 309,43 '0'" -draw "text 331,23 '0'" -draw "text 331,33 '0'" -draw "text 331,43 '0'" -draw "text 353,23 '0'" -draw "text 353,33 '0'" -draw "text 353,43 '0'" \) \( base/base_gh5_xbox_guitar.png -clone 0 -geometry +100+2 -composite -draw "text 287,23 '0'" -draw "text 287,33 '0'" -draw "text 287,43 '0'" -draw "text 306,23 '10'" -draw "text 306,33 '10'" -draw "text 309,43 '6'" -draw "text 331,23 '6'" -draw "text 331,33 '4'" -draw "text 331,43 '1'" -draw "text 350,23 '58'" -draw "text 350,33 '43'" -draw "text 353,43 '0'" \) \( base/base_gh5_xbox_bass.png -clone 1 -geometry +100+2 -composite -draw "text 287,23 '4'" -draw "text 287,33 '4'" -draw "text 287,43 '2'" -draw "text 309,23 '0'" -draw "text 309,33 '0'" -draw "text 309,43 '0'" -draw "text 328,23 '10'" -draw "text 328,33 '10'" -draw "text 331,43 '6'" -draw "text 353,23 '1'" -draw "text 353,33 '0'" -draw "text 353,43 '0'" \) \( base/base_gh5_xbox_drum.png -clone 0 -geometry +100+2 -composite -draw "text 284,23 '18'" -draw "text 284,33 '17'" -draw "text 287,43 '2'" -draw "text 306,23 '10'" -draw "text 309,33 '0'" -draw "text 309,43 '0'" -draw "text 331,23 '0'" -draw "text 331,33 '0'" -draw "text 331,43 '0'" -draw "text 353,23 '0'" -draw "text 353,33 '0'" -draw "text 353,43 '0'" \) \( base/base_gh5_xbox_vocals.png -clone 1 -geometry +100+2 -composite -draw "text 287,23 '4'" -draw "text 287,33 '1'" -draw "text 287,43 '0'" -draw "text 309,23 '0'" -draw "text 309,33 '0'" -draw "text 309,43 '0'" -draw "text 331,23 '0'" -draw "text 331,33 '0'" -draw "text 331,43 '0'" -draw "text 353,23 '0'" -draw "text 353,33 '0'" -draw "text 353,43 '0'" \) \( base/base_bandhero_xbox_guitar.png -clone 0 -geometry +100+2 -composite -draw "text 287,23 '0'" -draw "text 287,33 '0'" -draw "text 287,43 '0'" -draw "text 309,23 '0'" -draw "text 309,33 '0'" -draw "text 309,43 '0'" -draw "text 331,23 '0'" -draw "text 331,33 '0'" -draw "text 331,43 '0'" -draw "text 350,23 '64'" -draw "text 350,33 '58'" -draw "text 353,43 '5'" \) \( base/base_vanhalen_xbox_guitar.png -clone 1 -geometry +100+2 -composite -draw "text 287,23 '0'" -draw "text 287,33 '0'" -draw "text 287,43 '0'" -draw "text 309,23 '0'" -draw "text 309,33 '0'" -draw "text 309,43 '0'" -draw "text 331,23 '2'" -draw "text 331,33 '0'" -draw "text 331,43 '0'" -draw "text 350,23 '42'" -draw "text 350,33 '20'" -draw "text 353,43 '0'" \) -delete 0,1 \( -clone 0 \) \( -clone 0 -clone 1 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 1 \) \( -clone 1 -clone 2 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 2 \) \( -clone 2 -clone 3 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 3 \) \( -clone 3 -clone 4 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 4 \) \( -clone 4 -clone 5 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 5 \) \( -clone 5 -clone 6 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 6 \) \( -clone 6 -clone 7 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 7 \) \( -clone 7 -clone 8 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 8 \) \( -clone 8 -clone 9 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 9 \) \( -clone 9 -clone 10 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 10 \) \( -clone 10 -clone 11 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 11 \) \( -clone 11 -clone 12 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 12 \) \( -clone 12 -clone 13 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 13 \) \( -clone 13 -clone 14 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 14 \) \( -clone 14 -clone 15 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 15 \) \( -clone 15 -clone 16 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 16 \) \( -clone 16 -clone 17 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 17 \) \( -clone 17 -clone 0 -morph 3 -delete 0,4 -set delay 10 \) -delete 0-17 -layers Optimize xTestx.gif
marclallen

Re: Problem using -set delay

Post by marclallen »

Ok... here's another example which shows why I use the delay 500 as well.
convert -size 160x46 xc:'rgb(0, 0, 0, 1.0)' -size 160x46 xc:'rgb(0, 255, 0, 1.0)' -delay 500 \( -clone 0 \) \( -clone 0 -clone 1 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 1 \) \( -clone 1 -clone 0 -morph 3 -delete 0,4 -set delay 10 \) -delete 0-1 -layers Optimize tp3.gif
Image

The code is designed to generate an animated gif that:

1) Shows a black frame for five seconds.
2) Morphs to a green frame using three morphing frames at .1 second each
3) Shows the green frame for 5 seconds.
4) Morphs back to a black frame using three morphing frames at .1 second each.

Now, maybe you've got a better way to do this? I'll take it, if you do.
marclallen

Re: Problem using -set delay

Post by marclallen »

This works:
convert -size 160x46 xc:'rgb(0, 0, 0, 1.0)' -size 160x46 xc:'rgb(0, 255, 0, 1.0)' \( -clone 0 -set delay 500 \) \( -clone 0 -clone 1 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 1 -set delay 500 \) \( -clone 1 -clone 0 -morph 3 -delete 0,4 -set delay 10 \) -delete 0-1 -layers Optimize tp4.gif
as does:
convert -size 160x46 xc:'rgb(0, 0, 0, 1.0)' -size 160x46 xc:'rgb(0, 255, 0, 1.0)' -set delay 500 \( -clone 0 \) \( -clone 0 -clone 1 -morph 3 -delete 0,4 -set delay 10 \) \( -clone 1 \) \( -clone 1 -clone 0 -morph 3 -delete 0,4 -set delay 10 \) -delete 0-1 -layers Optimize tp4.gif

Image

I can use the latter to solve my problem. I'd still like to know why the -delay function is doing what it's doing.
Post Reply