Steven Champeon <schampeo@hesketh.com> wrote:

> I think Jason Kottke made the smallest, at 35 bytes (non-transparent,
> non-interlaced), using Photoshop 5.2/Windows. I also believe that was
> the theoretical limit for how small they could get.

Well, that's what my own gifWriter.py comes up with too, but it's
actually not technically the smallest.

According to the GIF spec:

"The Definition of the GIF Format allows for a Data Stream to contain
only the Header, the Logical Screen Descriptor, a Global Color Table and
the GIF Trailer."

That is, you can have not only a GIF with >1 images, but also a GIF with
0 images. Since it contains no images it is considered transparent even
in GIF87a format. So the smallest shim-gif I know of is this -

  47 49 46 38 37 61  (GIF87a)
  01 00 01 00        (size: 1x1)
  F0                 (has Global Color Table, originally 8bpp palette)
  00                 (background colour)
  00                 (no pixel aspect ratio)
  00 00 00           (colour 0 is black)
  00 00 00           (colour 1 is black)
  3B                 (end of stream)

- just 20 bytes.

But! It doesn't work in Netscape 4 and it doesn't work in IE/Win. It's
fine in Mozilla and Opera, of course.

Another trick is to get rid of the global colour table, so the image has
no colour at all. This results in file sizes of 29 [solid] and 37
[transparent] bytes. This works in IE/Win!! ...but is of dubious
validity, and causes Mozilla and Opera to crash hard.

Combine these tricks and you end up with a 14-byte GIF. Which
comprehensively fails to work across all browsers. Do I get a prize?
and@doxdesk.com