The discovery of GIF animation — told by the discoverer himself

At 31C3 I had a chat with Heiner Wolf. He is one of the guys who, in 1995, experimented with live web video and came up with a modified GIF that allowed animation. So the animated history of GIFs started with a hack. He tells the story of this discovery in his blog and allowed me to translate his text, and here it is (keep in mind that, from now on, every ‘I’, ‘me’, ‘my’ and so on refers to Heiner Wolf!):

Animated GIF

In early 1995 at the University of Ulm (Germany), we presented a model railway on the web. Visitors could let the train drive around in circles. A camera shot pictures of it. But to see the current picture, one had to click on RELOAD in the web browser. We wanted to have a live video and searched for a way to enable this with the technology of that time. Eventually we (Konrad Froitzheim an me) took a closer look on GIF89a. I built an animated GIF with a hex editor and put it into the up-to-date browsers (XMosaic, Netscape Navigator). And what was happening? Nothing, exept for one picture. GIF was only supported as a (single) image format, not as an animation.

Image source: http://blog.wolfspelz.de/2015/01/animated-gif.html
Image source: blog.wolfspelz.de

It was even worse: Mosaic wanted to download all single images completely, before showing the first piece of HTML. This wasn’t suitable for live video, obviously. We wanted to send this live video as an never ending animated GIF from the HTTP server to the browser. But Netscape 1.1 showed an interesting behaviour: progressive decoding, which was very innovative at that time. New data was shown when it reached the browser (instead of showing the page just when everything was loaded completely). Thus it was clear that this software architecture was sufficient to show animations. Someone just had to tell Netscape about it.

So I copied the Netscape feedback form on our model railway website, where many visitors used it to send an (already prepared) request for GIF animation support directly to Netscape. And eventually Scott Furman from Netscape contacted me and asked for more information about the topic animated GIF. I sent him everything and some example files. Shortly after that Netscape 2.0 was released — with animated GIF support. Scott invented the loop marker for that. GIF98a was designed as a stream without a loop, therefore he implemented the loop marker as a GIF comment. This was a very neat idea and the final step to make all the endless looping icons possible.

Live Video

Netscape’s marketing department appparently didn’t get these news, because the great features were Javascript, framesets and cookies. Nothing about animation. But it worked. Both as an endless loop as well as in stream mode (the server holds the connection and sends more and more frames). So I programmed a server that coded the stream of the camera into an animated GIF (with C as nph-cgi). After showing the first full frame, the video server searched for the image areas that had changed, coded a new frame with only those areas changed and sent it online. The URL of the stream, contained in an HTML <img src=> tag did actually show a video.

The visitors of the model railway could see the train ‘hopping” around the oval rail track approximately every second. Unbelievable how easy it worked all of a sudden. It was the first live web video. And the only true ‘live’ web video at all for a long time period.

Image source: http://blog.wolfspelz.de/2015/01/animated-gif.html
Image source: blog.wolfspelz.de

Then PNG showed up and I was in regular contact with Thomas Boutell. PNG had many revisions, but Thomas didn’t want to implement animation. ‘First we do the image format. When this is established, then animation follows.’ He feared that animation may cause complications and harm PNG. Maybe he was right. But in the end it was the animation that was missing to leave GIFs behind. A browser developer, who wants to implement PNG along with GIFs (back then), was uncertain about what to do with those parts of the code where GIF delivers more frames, but PNG doesn’t. So he has to leave them empty, reasonably. If he has to change the code now, when PNG animations should be possible as well, the empty parts have to be reconstructed. Far worse if the PNG animation is called MNG and has another MIME type. In this case a whole new decoder besides PNG has to be integrated, which works just like GIF. All this is a little exhausting. Or at least it means more effort than dealing with aPNG just at the very time when aGIF was implemented.

It was also clear that GIF was not ideal for photographs and camera pictures, because of its colour palettes. So it was an obvious idea to apply the GIF animation principle also on JPEG. Actually it is quiet easy. GIF has a header, then a full image, then other images that can overlap and cover parts of the full image at some position, using coordinates. This is a diffirential coding without further optimization, but much better than always using full images.

Animated JPEG

The structure of JPEG is similar to GIF (and PNG). But the compression algorithm works completely different. But in both cases we have chunks (packages of data) that are lined up one after another. The header is a chunk or even several ones. The data of the image are in one chunk. Comments, loop marker, geo coordinates, timestamp are all several chunks. In animated GIFs, the first image chunk is followed by further ones. All of them have a size and coordinates and overlap the prior image data. In combination with the delay the results is an animation.

Image source: http://blog.wolfspelz.de/2015/01/animated-gif.html
Image source: blog.wolfspelz.de

The same way it would be with JPEG. Usually JPEG comes with a header, then one full image, that’s it. If this first image would be conjoined with other following image chunks with delay, coordinates and size, the animation would be complete. Just a loop marker and there we have the truecolour animation.

We (Michael Merz, Holger Bönisch and me) programmed that and offered it to Tom Lane, who administrated the JPEG code. Unfortunately he rejected it, stating that MPEG is meant for animations. He has a point there. But the same could have been said about GIF. But that was not the case. An MPEG decoder is an incredibly complex and sensitive piece of software. No browser developer integrated MPEG directly, it was always done via plugins or Quicktime. Many films were incompatible and lead to a browser crash. When Microsoft dominated the browser market, they weren’t able to embed films on websites in a handy way. Microsoft’s fail was so colossal that Flash players have been the successful alternative and the tool of choice for truecolour animations.

It’s been 15 years until finally an MPEG file could be embedded via <video src=> without Flash and much effort. If JPEG would have been extended as an animation format like aGIF, we would have had an easy method to do truecolour animations since 1997. GIF would only be used for small animated icons at most, animated JPEG for ‘short’ truecolour animations with proper compression and actual video codecs with best compression methods would be used for whole films.

Actually, GIFs would have been overrun by animated JPEG. And in fact, this would be a good idea, still today.

– Heiner Wolf

For the original German text and even more illustration, visit Heiners Blog. There you can also find a copy of the very first animated GIF on the web.

Advertisements

One thought on “The discovery of GIF animation — told by the discoverer himself

write comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s