A GIF manipulation tool thing progammed in C

NEW NEW NEW AND SUPER BETA try it in your browser!

e803 - a story

One day I had my website open for a really long time. When I looked at the page, I noticed one GIF stopped animating. This puzzled me. Was this a bug in the browser? That would be weird, because the others were working fine.

I opened the hex editor and inspected the GIF. It didn't make me much smarter; I only noticed NETSCAPE2.0 and some file paths to GIF files of which I both thought was strange.

Then I started researching the GIF format. Apparently, the NETSCAPE2.0 is in virtually every animated GIF. It's an unofficial header for the GIF format; GIF89a could animate, but it could do so only once. That header contains two bytes that make up a number that makes up the amount of times it should loop. A value of 0 means loop forever.

The original GIF looped in hexadecimal E803 - or 59395 in decimal. I hex-edited the block to 0000(loop infinite). But then as I gathered more GIFs I noticed that more of these GIFs stopped at the same time; they also had the value E803. Usually they also contain a weird header called GIFCONnb containing filenames and zeros, and sometimes a comment:

This GIF file was assembled with GIF Construction Set from:

  Alchemy Mindworks Inc.
  P.O. Box 500
  Beeton, Ontario
  L0G 1A0

  This comment block will not appear in files created with a registered version of GIF Construction Set

So many gifs contain this. I think the GIF editing program or whatever it is just set that header to E803. It's so strange. Why would a program specialized in GIFs do this? Didn't the programmers notice?

Somewhere in all this I started to work on a program to make animated GIFs loop indefinitely again. Then I also made a comment remover, and unknown header remover, and a plain text extension block remover. This has impact on file archeology, but it shaves off some bytes.

Apparently you can still buy the weird software. If you hover over the images you get to see a funny message. This must have been the page around that time. or maybe even this. What a different time.



One-click install and run:

Well not really. Click the line of code. If you're lucky, the hack worked and the code will get copy-pasted, and if you run it in a terminal you'll be able to paste it and run it(hopefully)!

Debian/Ubuntu/???: wget && cc -O3 -o giffer giffer.c -Wall -std=c99

idk about windows tho I tried but it crashed pretty bad. I tried my best.

... and now ./giffer <files>!

WARNING: This program was made by a mammal behind a keyboard. The mammal had the best intentions, but cannot guarantee success. Always make a backup of your GIF files if you're going to use this program! The mammal also does not accept returns.


-u, --update edits the files and makes them loop infinitely if applicable.
--read-only don't touch the files; just look at them.
--read-comments read & display comments & plain text extension blocks
--remove-comments remove comments & plain text extension blocks
--remove-unknown remove unknown application headers
--nuke copy the file and put it in a new one(with _new behind it) - but without comments, unknown application blocks, and other stuff. Does not touch loop count. Will make file archaeologists mad.
-- treat every argument as a file from here