axsWave Software, Inc.Homeentre@metronet.comWho We Are
Web ServicesIntranetsmarket researchpromotional literatureTips Library


GIF and JPEG Quality

by Janette B. Bradley
axsWave Software, Inc.™



GIF Quality Range

The GIF (Graphics Interchange Format) format allows you to save an image with anywhere from 2 to 256 colors. However, the fewer the colors the smaller the file size, and the faster the file will load onto a client's machine.

As an example, I created a ball created with 24 bit color allowing for approximately 17 million colors. I then saved the ball in GIF format, at different bit depths, with the corresponding number of colors for each bit depth. Except for the first ball which was remapped to monochrome (black & white), all the other balls are saved with an Adaptive Palette. This means that the conversion program chose the best set of colors it could given the number of colors chosen for the final GIF image. For example, the sphere at 2 bits (4 colors) uses 3 shades of blue and 1 white for a total of 4 colors.

On the sample page, you can see the change in quality as the number of colors goes up. Again, the conversion program is choosing the colors automatically, to give what it considers the best color set for the final image.

Gif Quality Range Example


To Dither or Not to Dither

Dithering happens when the range of colors is not sufficient to represent the colors in your graphic. The computer "mixes" colors to get closer to the one you have created

In most cases, it is preferable to avoid creating a dithered graphic. Dithered graphic files are larger and their quality is usually not as good, often resulting in random spots or "measles" on a graphic.

One caveat - if the graphic conversion program you are using does not have the ability to create an adaptive palette, dithering may produce a better result. If you know that your conversion program does not have the ability to produce an adaptive palette, you should experiment to see what produces the best result.

Dithering GIF Files


JPEG Quality Changes

JPEG compression allows you to retain millions of colors, but it is a "lossy" compression scheme. It makes file sizes smaller by throwing away some information. While it retains all the colors, the loss of some information can cause the quality of the file to suffer.

Note: You will only be able to see milions of colors if your monitor and graphics card support them. The large majority of people on the web use systems that are capable of at most 256 colors.

Unlike GIF, where you specify the number of colors when you save a file, with JPEG you specify the level of quality.

Highest Quality is 100% lowest is 25%

Test your file at different quality ranges. In many cases, you will find that 50% is acceptable.

Remember, the smaller the file the faster it loads.

JPEG Examples


GIF versus JPEG

The decision to use either GIF or JPEG is not a hard and fast rule. In general, you should use JPEG for photos or images with a continuous tone, or gradient. That does not hold true for all images. Many images will be very acceptable, if not excellent quality when saved as GIF format.

The best advice that I can offer is to test your image as GIF and as JPEG. One thing to keep in mind is that although JPEG files are smaller they will load slower than GIF files.

There is one caveat: Unless you are trying for a special effect, do not use JPEG conversion on a graphic with large areas of a single color. The algorithm introduces random dots in these large areas, giving the impression has measles. These dots are very apparent at 256 or lower colors. You may have seen this on sites where they used a sidebar background saved as JPEG. The white area to the right of the sidebar will have little speckles. This is the sign of an individual who tends to work in millions of colors. Not a bad thing if you can guarantee that your audience will be viewing the image in millions of colors. Otherwise, always test at 256 colors. If you are designing for K-12 education, I would strongly suggest testing your graphics at 16 colors.

GIF versus JPEG



Feel free to contact me with questions or to talk about how the axsWave Software team can help you with your Web site:

Janette B. Bradley (janette@metronet.com)

axsWave Software, Inc.Homeentre@metronet.comWho We Are
Web ServicesIntranetsmarket researchpromotional literatureTips Library

Copyright ©1996 Janette B. Bradley. You may place a link to this article or use it in a published work with proper citation, but you may not reproduce it or redistribute it in its original or any altered form.