Calculated duration != real duration of gif

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
Shaun
Posts: 8
Joined: 2013-04-25T23:06:34-07:00
Authentication code: 6789

Calculated duration != real duration of gif

Post by Shaun »

Hello,

I have a gif with the following details:
Iterations: 2
Number of Frames: 12
Each frame with following delays:

Code: Select all

  Delay: 50x100
  Scene: 0 of 12

  Delay: 50x100
  Scene: 1 of 12

  Delay: 50x100
  Scene: 2 of 12

  Delay: 50x100
  Scene: 3 of 12

  Delay: 50x100
  Scene: 4 of 12

  Delay: 100x100
  Scene: 5 of 12

  Delay: 50x100
  Scene: 6 of 12

  Delay: 150x100
  Scene: 7 of 12

  Delay: 150x100
  Scene: 8 of 12

  Delay: 100x100
  Scene: 9 of 12

  Delay: 50x100
  Scene: 10 of 12

  Delay: 100x100
  Scene: 11 of 12
If I calculate the duration of the gif, I get 1900cs. 2*(50+50+50+50+50+100+50+150+150+100+50+100)=1900
But if I open the gif, it runs about nearly 30 seconds (3000cs).
What variable am I missing here? I checked the whole identify -verbose info and couldn't find any other variables that could be responsible for it.

I would be happy to get any advice. :)

Full -verbose info (without colormap and histogramm): http://pastebin.com/MHUepNVw
Shaun
Posts: 8
Joined: 2013-04-25T23:06:34-07:00
Authentication code: 6789

Re: Calculated duration != real duration of gif

Post by Shaun »

Gnah... found the problem: My brain.

Solution: Iterations + 1. Because the iteration defines the number of replays, not the number of plays.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Calculated duration != real duration of gif

Post by glennrp »

I'm getting correct timings with a 2-frame GIF with 2 iterations and 500cs delay (total 20 sec)
when I display it with "animate" from IM-6.8.8-0 (before recent changes to gif.c) and IM-6.8.8-4.
What are you using to display the GIF? Firefox seems to show the animation a little too
fast. but infinite duration because it shows the final frame indefinitely. Chrome seems to
be even a little faster, and it shows the animation 3 times instead of 2 and then, like Firefox,
displays the final frame indefinitely. So your solution will work with Chrome but not Firefox
or "animate". I don't have IE so can't test that. If the duration is important to you, you'll
have to use browser-sniffing to decide what "iterations" means. I'm not aware of an actual
specification that tells that. It's in a "netscape extension" so the specification would be
the netscape source code.
Post Reply