MWC Home Page

Technology Training Home > Multimedia > Digital Imaging > Real World Examples

Real World Examples
by Andy Rush

Gif

non-dithered gif (3274 bytes)O.K. We could talk until we're blue in the face about when you should use gif and when you should use jpeg for your images in a web page. Sometimes it is just best to show you. The Gif format is best for logos or "line art" images, or those with large blocks of solid colors, such as the black, gray, red, white, and blue of the image to the left.

The gif compression scheme, or algorithm, works best at analyzing those solid colors and how they are arranged in the image, and describing the image more simply. This has the advantage of a producing an image with a relatively small file size.

Let's see what happens to the image when we use jpeg compression on this image.

 

 

high quality jpeg (11272 bytes) medium quality jpeg (6717 bytes) low quality jpeg (4626 bytes)

high quality jpeg
(11,272 bytes)

medium quality jpeg
(6,717 bytes)

low quality jpeg
(4,626 bytes)

The three images above demonstrate the effect of using jpeg compression on the image of the stamp. The high quality jpeg looks good, but it's more than three times the size of the gif version. As the quality goes to medium and then to low, the file size gets smaller, but the quality gets poorer. The gif version, at 3,274 bytes, is still a smaller file size than the lowest quality jpeg. Gif is the obvious choice for the image of the stamp.

 

Jpeg

high quality jpeg (11447 bytes) medium quality jpeg (6315 bytes) low quality jpeg (3921 bytes)
high quality jpeg
(11,447 bytes)
medium quality jpeg
(6,315 bytes)
low quality jpeg
(3,921 bytes)

Jpeg really shines when you are displaying "continuous tone", or photographic images. There are different quality settings you can choose as well, and will involve a trade-off of file size. The high quality jpeg looks great but is almost three times the file size of the low quality jpeg. If you can get away with it, use the low quality version, or compromise with the medium quality.

Now let's see what happens when we try to use gif compression on the images of the building.

optimized gif (24789 bytes) 256 color gif (14057 bytes) 64 color gif (11386 bytes)
optimized gif
(24,789 bytes)
256 color gif
(14,057 bytes)
64 color gif
(11,386 bytes)
16 color gif (7597 bytes) 8 color gif (6164 bytes) 4 color gif (4011 bytes)

16 color gif
(7,597 bytes)

8 color gif
(6,164 bytes)

4 color gif
(4,011 bytes)

You can get a gif version of this photograph to look as good as the high quality jpeg, but with the penalty of a large file size. As we reduce the number of colors in these images, you see a corresponding degradation in image fidelity. Also notice the dithering (the scattered dots) that occurs (Note: if you are viewing this on a 256 color video card setting, all of these images will have dithering). The 8 and 4 color gifs approach the file sizes of the medium and low quality jpegs, but the color fidelity is unacceptable. Jpeg is the obvious choice for the image of the building.

 

This Page Last Modified on: November 4, 2002

[Resources for Prospective Students] [Resources for Current Students] [Resources for Faculty and Staff] [Resources for Alumni] [Resources for Community and Visitors] [A to Z Index] [People Search] [Search MWC]
[MWC Home Page]

Division of Teaching and Learning Technologies
Mary Washington College
1301 College Avenue, Chandler 105
Fredericksburg, VA 22401-5358
Tel. 540.654.1379 Fax 540.654.1068

This Web Page Maintained by
Andy Rush
Department Site Index
Comments or Questions?

To JMC Home Page

[James Monroe Center Home Page]