WHAT IS A GIF?

Everyone loves GIFs, right? They’re ubiquitous in internet culture, after all. The answer is no, not everyone loves them. In fact, I despise GIFs in all of their forms. Welcome to my exploration of why the GIF format is awful and should be retired.

I often run across the term “GIF” used in a very specific way – that is, to refer to a short, looping animation or video clip. They are usually small in terms of pixel dimensions, and always offer terrible visual quality due to the nature of the format. The GIF is outdated, inefficient, and ugly.

HISTORY OF THE FORMAT

The GIF format was developed in 1987 by some nerds working at CompuServe. If you don’t remember CompuServe, that’s OK. It was an early-days internet service provider similar to Prodigy or America Online, basically a front-end portal for internet services before direct access to the World Wide Web via browsers became popular. It was fun for a while, but it was more or less over by 1995 or so. In any event, the GIF is their lasting legacy on the internet.

You may be aware of the age-old internet argument about whether GIF is pronounced with a soft- or hard-G, but I don’t feel it’s necessary to debate the merits of either pronunciation here. The truth is, it doesn’t matter how you pronounce the thing, as long as you know the meaning is “trash.”

THE GIF IN 2021

So, given that GIFs are inefficient and ugly, why are they still literally EVERYWHERE? GIFs as commonly used in 2021 are basically novelties; they’re used as reaction images in forums and chat apps, and for that purpose they serve well enough, at least as far as it concerns the end user. Further, the relevant patents behind the format expired in 2003-2004 or so. Just about every browser and platform supports gif playback at this point, so it makes sense that they would be ubiquitous. I’m not saying I agree with it, just that I understand.

In professional applications, I see them pop up most often in two contexts: for use in display ads, and requested by clients who are using the term GIF as a generic descriptor of a short, looping video. For the purposes of this discussion, I’m going to focus on the second scenario.

A WORD ABOUT IMAGE AND VIDEO COMPRESSION

There are numerous formats for image compression. JPG and PNG are the ones you’ll encounter most often, and they represent the two paradigms of compression: lossy and lossless, respectively. Basically, a JPG works by breaking an image up into blocks and removing information below a user-defined threshold. With optimized settings, file size is reduced and image quality and color depth are qualitatively preserved. Some information is lost, hence the “lossy” designation. PNG, on the other hand, retains the full color depth and pixel data of the original uncompressed image, but generally results in larger file sizes than JPG. PNG also supports transparency (alpha channel) information.

The GIF functions differently than both of these. A GIF has a maximum of 256 total colors, one of which may be “transparency.” Full-color photos are usually encountered in 8-bit-per-channel color depth, which translates to 16,777,216 possible colors. So you can see immediately that no matter what settings you choose when making a GIF, there is going to be significant loss of color information. Beyond that, the GIF uses LZW compression, which is not optimized for image compression. That means that file size is going to be quite large relative to other formats.

image_comparison-simple-gradient

In this comparison, you can see that the JPG is the best choice for these images. Smallest size, full color. PNG looks great, too, but has a file size about 4 times that of the JPG. GIF handles color gradients especially poorly. You can get around it a bit by introducing noise or dithering, which is more apparent in the full-color image, but it still looks significantly worse, and with a larger file size. But the shortcomings of GIFs become more stark when discussing video compression.

H.264 (usually in a MP4 container) is still the most common distribution format for videos, for the time being. We don’t need to delve too much into the technicalities of how that works, but much in the way that JPG compression culls “unnecessary” information from an image, H.264 compression does the same with video, except it also applies that paradigm across multiple frames, based on the idea that with each individual frame of video being on screen for a fraction of a second, they can each stand to lose more detail without resulting in a noticeable drop in quality for the viewer. (Why not just use JPG compression on each frame, you may ask. Good question – that’s actually a thing, and the codec is called Motion JPEG. It’s functional, and while it’s still superior to GIF, it is quite outdated.)

Here’s where things start looking really grim for the GIF.

video_comparison_2

In this comparison, you can see the differences in quality and file size are significant. The MP4, while not totally free of artifacts, produces a clip that’s quite nice in terms of color and sharpness, at one fifth of the file size. The GIF, by contrast, gives a bloated file that looks terrible.

video_comparison3

In this comparison of a logo animation with fine, granular particle effects, the four examples proceed from left to right, from highest-quality (least-compressed) to lowest quality (most-GIF-ified). You can see that the H.264 version loses some of the finest detail in the particles and film grain, and while that’s unfortunate, it’s also not a big deal when the video is playing. Proceeding to the Full-resolution gif, it not only has noise, it introduces MORE noise due to the limitations of the 256-color palette. It also, for some reason, comes out with strange and unpredictable color errors, not to mention an absolutely massive file size. It’s larger than the ProRes 422 file, which is simply ridiculous. And finally on the far right, in an attempt to get closer to a usable file size, I sliced the image resolution to 640×360 (the original is 1920×1080). Even with optimization on exporting the GIF, it weighs in at a hefty 19.7 MB, more than twice that of the full-resolution, full-color MP4.

FINAL WORD

I don’t know how much more I need to belabor this point. GIFs just suck. And in this day and age, as content producers, we shouldn’t be using them unless there’s literally no other choice. Your mileage may vary, of course.

And in the interest of full disclosure, yes – I do use reaction gifs. But I feel a little dirty when I do. I’d much rather use reaction mp4s.