Trivia: Animated GIF Timing

Every now and again, someone reports that Internet Explorer is "slow" when rendering an animated GIF file. Typically, they'll load a lengthy animation in Firefox and IE and note that it runs much more quickly in Firefox. Similarly, Chrome and Safari are "slow" while Opera is "fast." Conversely, there are bug reports against Mozilla complaining that they're rendering "too fast" and should render the image more slowly.

What's going on here? Legacy compatibility with ancient versions of Netscape. An animated GIF specifies its own frame duration internally, but some of the original tools specified extremely low frame-durations (e.g. 0ms) knowing that Netscape would render the image no faster than about 10 frames per second. Therefore, if IE encounters a GIF file with a frame duration of 50ms or fewer (20fps), it will delay the animation to 100ms (10fps).

A sample image (a 2.7MB GIF mislabeled as a JPG) was reported by someone in the community and can be found here.


Update: IE10 Consumer Preview increases the supported frame-rate; frames may be shown with a delay as little as 20ms. If the server specifies a lower delay, the animation is delayed to 100ms for legacy compatibility. 

Comments (15)
  1. Paul Irish says:

    So an animated gif with frame durations of 51ms with be fine, but once its hits below that, frames are dragged way down to every 100ms?

    Why not just maintain the floor at 50ms?

  2. TheCycoONE says:

    Luckily no one has used an animated GIF since the fall of GeoCities and this has become a non-issue?

  3. EricLaw [MSFT] says:

    @Paul: The exact rationale is lost to the sands of time, but I'd imagine the explanation is that it was found (over a decade ago) that the "bad" tools would generate values below 50ms (expecting to get 10fps), and the "good" ones would generate values above 50ms. Hence, as an accommodation for "bad" tools, any value less than 50ms was demoted to the "compatible" 100ms value.

    @Stephen: It's fair to say that animated GIFs are far less common than they once were, although they're still commonly used for progress spinners and the like.

  4. MoD says:

    @Paul Irish: FWIW, the GIF spec specifies times in 1/100ths of a second, so 51ms is not possible to use as a GIF frame timing, 60ms is the closest available that's greater than 50.

  5. Caleb Bradley says:

    You posted: "if IE encounters a GIF file with a frame duration of 50 or fewer milliseconds (20fps), it will delay the animation to 100ms (10fps). " Does this apply to all versions of IE ?

    I wish to know if the information is sufficiently reliable to keep in English Wikipedia.

  6. EricLaw [MSFT] says:

    Caleb: This is true for IE5 and later at the very least, but the code probably went in for IE1 or IE2.

  7. Adam Barth says:

    We should just put an end to this madness and converge GIF rendering behavior.  🙂

  8. FremyCompany says:

    Not sure if this behavior is still applyable for IE9 PP3, though.

  9. EricLaw [MSFT] says:

    @FremyCompany: IE's behavior here remains unchanged in the latest Platform Preview Build.

  10. AniGIF says:

    What about the case when it runs normally but slows down when zoomed and shows weird artifacts? With this GIF (…/Prince_of_Persia_%281989_video_game%29_IBM_PC_Version_gameplay.gif), you see weird artifacts (ghosts of previous frames) and the performance is blocky when zoomed.

  11. @AniGIF: I don't see any performance issue when zoomed, and this may depend on your graphics hardware. As for the artifacts, yes, this is a known low-pri issue which we're tracking with a bug #.

  12. steve smith - - sr. says:

    also shows the "ghost(s)" while negatively zoomed. (60%, 40%, etc.)

  13. Another longstanding GIF bug: GIFs configured with a loop count of 1 always play twice in IE:

  14. Here's a complaint that IE11 incorrectly delays the first frame of the animation:…/981223

Comments are closed.

Skip to main content