giftab

giftab is a tiny utility that I wrote that changes the color table entries in a GIF file. It was written to be used at a Unix command prompt, and has been tested on OpenBSD and Linux. There should be no difficulty porting it to other platforms, and I suspect in many cases it will build without any modification.

This program is pretty simple and hardly worth being here at all. It exists because I wanted to make it easy to change the color scheme of my website without having to modify all the images individually. What giftab does is use the index provided as an entry into the color table, which starts at an offset of 13 in a GIF file. Individual entries are three bytes apart.

It is easy to use:

giftab index_number color [index_number color ...] filename

The index_number is a value from 0-255 that represents which table entry to change. color is an HTML formated color code that specifies the new color. Note, that while it is possible to use a octothorpe (#, also known as a pound sign) to prefix the color code, it will have to be encased in quotations to prevent the shell from interpreting the rest of the line as a comment.

The filename is simply the name of the GIF file that is to be worked upon. Note that no special GIF file sanity checking is performed.

I'm not providing a binary image, so you'll have to compile and link it yourself. Using gcc, this is a piece of cake:

gcc -o giftab giftab.c

The C source code can be downloaded here, or you can just copy and paste it from below: