Page 1 of 1

Calculated duration != real duration of gif

Posted: 2014-02-04T05:46:27-07:00
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

Re: Calculated duration != real duration of gif

Posted: 2014-02-04T09:14:51-07:00
by Shaun
Gnah... found the problem: My brain.

Solution: Iterations + 1. Because the iteration defines the number of replays, not the number of plays.

Re: Calculated duration != real duration of gif

Posted: 2014-02-04T09:23:24-07:00
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.