R. Craig Collins > Intro to Computer Graphics > gif
gif © R. Craig Collins, 2007
Graphics Interchange Format, or gif, is an 8 bits per pixel bitmap; this means the image can have no more than 256 different shades, making it best suited for line drawings and charts.
The low number of bits yields smaller file sizes than bmp, but gif files can also be compressed, to further reduce the file size. (More about compression coming)
Originally, gif was under a patent, meaning it cost companies to add gif support to digital image editors... so there were several attempts to replace the format on the Internet. Now that the patent has expired, gif is freely distributed, and remains popular on the Internet for simple files that don't use a lot of color.
Other features that made gif popular are:
animation, and the fact that Microsoft Paint can save a simple line drawing as a gif.
Transparency is telling the computer to ignore part of an image, so what ever is behind it shows through
|File with transparent background on bgcolor="white"||
Same file with transparent background on bgcolor="black"
|Same file with transparent background on background="bricks"|
Interlacing is a method of displaying an image that was used primarily for slow Internet connections. Normally, an image won't display until it fully downloads. If a file was interlaced, parts of the file would display almost immediately, and the image would continue to "fill in" until the whole file was downloaded. The faster your internet connection, the faster the image would "fill in."
The interlaced demo below continually repeats, and is actually an example of the next topic, animation.
Animation with gif is the ability to store multiple images in the same file, and display them one at a time. This behaves just like a flip book kids often make... draw several images on separate sheets, then flip through the pages to see animation. (More on animation to come.) The animation below is just two images (ball at the top, ball at the bottom, and the as soon as it shows both, it starts over), the interlaced animation above is about 30 images.
Using Microsoft Paint to save as gif
If you open an existing image in Paint, you can choose File\Save As ... gif
Since the image you opened is 24 bit color, and gif is limited to 8 bit color, the computer will attempt to mix colored dots to approximate other colors, this is called dithering.
Below is a close up of how Paint will dither to make the blue and orange from the limited palette.
Later, the discussion will include tools better suited to gif than Paint, such as GIMP and Photoshop