This journal is a duplication of this news article. It has been provided so that the images needed by the article can be seen.
You've had the idea, you've built your emotes, you've put them all together in an animated GIF which you upload for the world to enjoy. The comments start coming in; "Sweet", "Cute", Love it", "Why is it so slow?". All well and good, apart from that last one.
So you take a closer look and either:
a) you scratch your head and think "it wasn't that slow when I built it"
b) you think it looks fine but other people are still saying it's slow
So what's the problem? The answer is Stupid Browsers. Simple as that. Our browsers are just rubbish at rendering fast animated GIFs.
An animated GIF file consists of a number of image blocks, each with it's own control block. The control block includes how long (in 1/100s of a second) the image should be displayed before moving on to the next image.
The GIF Programming Reference
has this to say about the frame delay:
Process each graphic in the Data Stream in sequence, without delays other than those specified in the control information.
Delay Time - If not 0, this field specifies the number of hundredths (1/100) of a second to wait before continuing with the processing of the Data Stream. The clock starts ticking immediately after the graphic is rendered.
All very simple, the rendering engine should simply wait for the specified delay before moving on to the next image. No exceptions! A delay of 0 should be interpreted as instantly displaying the next image and is of no practical use for creating animations. Some programs, JASC Animation Shop for example, will not allow a 0 delay. As each frame in a GIF can have it's own local colour map, some programs have even used the 0 delay to create static GIFs with more that 256 colours
Imagine a series of animated GIFs that all show a progress bar. These GIFs are identical except for the frame delay. The first has a delay of 1/100 seconds, the next has 2/100, the next has 3/100, etc. When the first bar has finished the second should be half finished, the next only one third finished, etc. If you took a screenshot you should see this:Perfect Browser
So that's the theory. After a number of people had mentioned problems with their animations being slower than they had build them, I decided to investigate and put together a test page containing the GIF progress bars described above. I then loaded this test page into a number of browser/OS combinations to see what happened. What I found was a remarkable example of piss poor programming.
- Mozilla's rendering engine seems to have taken the line that, as screens cannot refresh faster than 90Hz, no one will ever use a delay of 1/100. So a 1/100 delay is changed to 10/100. Not what you asked for. Mozilla's answer to the 0 delay is to ignore the specification and use a delay of 10/100.
- Internet Explorer is even worse. Any delay less than 6/100 is changed to 10/100. This is probably based upon the assumption that if 15fps is good enough for cartoons then it's good enough for animated GIFs.
- Opera is the worst of all. Every delay below 10/100 is displayed at 10/100.
- Safari is the best as far as delay cropping is concerned. It does crop below 3/100, but it crops to 3/100, not back to 10/100.
The figures below show screenshots of the test page displayed by various browsers on different platforms (this test page is available here
- you may find this test works best if you download it and run it locally).Firefox 1.5 on Windows 2000 / XPFirefox 2.0 on Linux 2.6.5Firefox 2.0 on Windows XPInternet Explorer 6 / 7 on Windows 2000 / XPMozilla 1.7.6 on Linux 2.6.5Netscape 8.12 on Windows XPOpera 9.10 on Windows XPSafari 1.2 on Mac OS 10.3
Conclusions and Recommendations
If all the browsers followed Safari's example and just stopped making the delays faster then there would not be too much of a problem. If you ask Safari for a delay of 1/100 seconds and it delivers 3/100 then the animation might not be as fast as you wanted, but it will probably be fast enough. However, asking Internet Explorer and the Mozilla browsers for 1/100 and getting 10/100 is a significant problem.
So what delays should you use when animating GIFs? Well never 1/100 or 0; imagine what would happen if one of the popular browsers decided to honour the 0 delay! As over 2/3 of visitors
are using Internet Explorer I'd suggest not dropping below 6/100. If you really need to go faster than that (and I have seen a few emotes
that were stunning at 2/100 in Firefox) then make it clear on your description what browsers it is suitable for. If you're feeling generous then you could always provide an alternative IE version.
SummaryNever, never, never use delays of 0 or 1.
Avoid 2 - 5 if possible.
1. GRAPHICS INTERCHANGE FORMAT Version 89a [link]
2. Wikipedia's GIF entry describes True Colour GIFs [link]
3. Browser share data provided by ~leSicilien