Battle of the (image) bands

Battle of the (image) bands

What if I told you an insurance company was the reason we have emails and gifs? Buckle in for some greed, controversy and chaos in this one.

Where it begins

In the 70's, mainframe computers were two things: expensive and rare. An American life insurance company (Golden United) turned this into a Nathan For You opportunity: sell their excess mainframe capacity (during nights and weekends) to businesses that couldn't afford their own.

So CompuServe was born. Initially it did what it said on the tin: served compute power. But soon, it would become a portal of information. A homepage, if you will.

The portal contained weather, news, stocks, banking, flight tickets, forums for special interests, and even an early form of email! You'd need to dial in, and it cost by the hour.

Nonetheless, tech fans of the day loved it.

Compuserve through the years: started in terminal, became software, ended on the WWW
July 1981 cover of CompuServe's magazine (left). Promotional material marketing CompuServe's Line Printer Art Gallery (right).

Radical, welcome to the late 80's: media content is growing in volume, and users want to share images seamlessly, but there are issues:

  1. Download speed: Average modem speed was 1200 baud (120 bytes/second, 7 minutes for a 50kb image). At a connection fee of ~$10/hour to access this service, every bit mattered.
  2. Consistency across devices: Different computers (IBM, apple, etc) used image formats incompatible with one another.

The solution? Build a lightweight coloured image format compatible with any computer over a slow connection.

This was the creation of GIF! Using the LZW algorithm for compression (remember that for later), GIF quickly became a standard for web graphics across devices.

LZW compression worked by replacing reused patterns in data with an alias name.

eg: if I replaced every use of "GIF" in this article with "g".

Rebuilding the image was a matter of translating back from those shortcodes.

100kb -> 40kb could mean savings of precious minutes, leaving you with more money for those fluoro rollerskates.

(Note, LZW is not limited to GIF, it's also found in TIFF, text compression, PDFs and more)

While making the GIF though, CompuServe's developers were (allegedly) unaware UniSys owned a patent to LZW!. I say allegedly because some reports out the developers for sitting on the knowledge for SEVEN YEARS before acting.

Where it gets tricky.

Fast forward to 1994. You've fed your tamagotchi? Good. Mosaic's browser displays images (no way) and 56k modems are coming in hot (yes way). GIFs are everywhere, and Unisys (the LZW patent-owners) decided something a little greedy:

All software using LZW compression now requires a paid license.

Oh, your product makes use of GIFs? Cough up 0.45% of the selling price to Unisys (Up to $10 per sale).

Use it on your non-commercial website? $5,000

Bigger companies (like Yahoo and Disney) had much higher costs, settling behind closed doors.

AccuWeather was given a $3.8 million bill. They flat out refused to pay and switched formats instead

Open source revenge

The response from developers was spiteful and productive, and within a year, the world met PNG files.

The initial name was "PING" (recursively -standing for "PING is not GIF"), using the '.png' extension.

It used DEFLATE compression, which is a combination of LZ77 and Huffman coding:

  1. LZ77

While LZW assigned a unique ID and stored each pattern in a dictionary, LZ77 (still made by Lempel and Ziv) drops the dictionary in favour of referencing the relative position of the first use of that pattern (eg: "go back 10 spaces, copy 5 letters")

Note: Unisys did not patent the compression, but rather the "Dictionary lookup". Lz77 dodges around this by not using the dictionary.

  1. Huffman Coding

So, you've got a file with repetitions simplified. How do you make it better?

Take a look at the conversion chart below, and you'll see every ASCII letter takes the same amount of space (8 bits)

If you organised letters into their frequency (in English), 'e' appears more than 'z'. So why not assign a shorter code (10) to e and a longer code (1110101) to z.

More common data takes up less space = file shrinks

And I know what you're thinking. If different characters can be displayed with different lengths, how does the interpreter know when to stop reading?

if e is 10, no other letter in the alphabet is allowed to start with 10. The next letter needs to be 110 and 1110 etc.

That's another cool trick of Huffman, no shortcode is the beginning of a longer code.

There is only one way to traverse the binary tree of values, so the interpreter does not need to rely on a fixed length.

Huffman tree (from Data Structures & Algorithms in Python)

A custom tree is made for every image. In a picture of a forest, green may be the most common bit, so it will be given the shortest path on the tree.

Burn all GIFS day

November 5th, 1999: Developers encouraged anyone running a website to delete/replace every GIF on their servers with PNG files, in a dramatic "burn all gifs day".

It aimed to scrub the web of GIFs, but wasn't as effective because of one thing: Animation.

Which means that quality alone is enough for us still, in 2026 (at time of writing) to use a file that adheres to rules written in 1989:

  • 256 colours (compared to 16 million with PNG)
  • Saving every frame as a separate image (5 seconds can be 10MB compared to an MP4 being 200kb)
  • No transparency
  • Hard on your CPU (compared to modern codecs)

So plenty of "gifs" you see now on GIPHY, Twitter (followingly known as X)), Imgur etc are actually .mp4 or .webm files, because it can display millions of colours with way smaller file size.

How come we can use them now?

How do gifs still exist? Are we all outlaws? Fugitives??

Patents only last ~20 years*, and they must also be filed/granted in each territory. Funnily though, since Unisys didn't file their patents for different countries on the same day, there was a staggered expiration.

So in 2003, it was legal to make gif-creation software in America, but illegal to freely sell that software for use in London or Tokyo without paying UniSys.

Not bad for a side hustle from a 1970's insurance firm.


Extra reading:

Burn All GIFs
Don’t pay outrageous Unisys royalties for obsolete GIF graphics. Burn them.
In 1999, The Internet Almost Ruined One Of Its Best Inventions, The GIF
On November 5 1999, while everyone else was worried about the Millennium Bug, ‘Burn All GIFs’ had a plan to destroy every single Graphics Interchange Format image in existence.

https://cs.stanford.edu/people/eroberts/courses/cs181/projects/1999-00/software-patents/lzw.html

45 years ago CompuServe connected the world before the World Wide Web
On September 24, 1979, Columbus-based CompuServe launched its online service for consumers. Its subscribers were among the first to have access to email, online chat, digital newspapers and the ability to share and download files.

https://thedayintech.wordpress.com/2021/09/24/come-online/

PNG file chunk inspector
How to Save Custom Data in Image Files | Nutrient
Image files hold more than just images, and in this post, you’ll learn how to save custom data in them.
Understanding and Decoding a JPEG Image using Python - Yasoob Khalid
Hi everyone! 👋 Today we are going to understand the JPEG compression algorithm. One thing a lot of people don’t know is that JPEG is not a format but rather an algorithm. The JPEG images you see are mostly in the JFIF format (JPEG File Interchange Format) that internally uses the JPEG compression algorithm. By the end of this article, you will have a much better understanding of how the JPEG algorithm compresses data and how you can write some custom Python code to decompress it.
Windows Metafile vulnerability - Wikipedia
The Huffman Code | Binary Trees | InformIT
<p>Binary trees are one of the fundamental data storage structures used in programming.</p>