#7 - know the difference between GIF and JPEG

Most browsers recognize graphics in GIF and JPEG formats. Just use the .GIF, .JPG, or .JPEG file extension and the browser will know how to handle it. So when should you use GIF and when should you use JPEG?

Both GIF and JPEG files are compressed. GIF uses a lossless compression scheme which is optimized for images with regions of solid color. JPEG uses a lossy compression scheme which is optimized for images with many mixed colors (like photographs).

GIF files only require additional size when the color of horizontally adjacent pixels changes. In other words, a horizontal line of a single color takes the same amount of space no matter how long it is. This makes GIF format ideal for solid color images like logos, cartoons, and text stored as graphics.

JPEG files use a lossy compression technique (slightly adjusting the colors) to give a visually similar image that takes less space. You can choose how much compression (and color change) you want. For natural, photographic, or multi-color images, JPEG does a good job. For lots of detailed information about JPEG, check out The JPEG FAQ.

Choose GIF file format when you have a solid color image, and choose JPEG when you have a photographic image. When in doubt, try both formats and choose the one that gives the best image quality for the lowest file size.

back to Website Design Tips

Copyright 1995-2003, CyberView Ltd.