Striking a balance between maintaining image quality and reducing the image file size to acceptable levels for internet use requires a degree of knowledge regarding image formats.
The most common formats in use on the internet are JPG, GIF and PNG, which can all be displayed by most modern browsers. Each image format has its strengths and the suitability of a format is determined largely by the type of image.
JPG
Used mainly for photographs the JPG format enables varying degrees of image compression. The degree to which an image can be compressed once again depends on the actual image itself. JPG is a lossy compression format which means that during the compression some image data is discarded and is permanently lost and therefore cannot be recovered during decompression of the image. The JPG format does not cope very well with images that contain large areas of flat colour as image artifacts can occur along the edges of such areas. JPG images do not support alpha channels so transparent backgrounds or areas of transparency are not possible.
GIF
The GIF format is an indexed palette format which means that true colour (24 million colours) images are reduced to the number of palette colours specified during conversion and compression. The maximum number of colours possible is 256 although palettes of 128, 64, 32 or 16 colours are more common, the less colours the smaller the file size. GIF images are suited to the compression of logos and computer generated images. The GIF format enables the creation animated images which consist of a number of individual images that are displayed in rapid succession. Animated gifs contain all the image data and the animation timing for each frame that enable the browser to display the animated image. The GIF format also supports pixel transparency which means that pixels of a particular colour index can be forced to be displayed as transparent by the browser thereby allowing the background of the web page to show through.
PNG
Portable network graphics format is a true colour image format that supports alpha channels which means that image transparency information can be retained during and after compression. PNG format images are not as compact as JPG or GIF images and they are currently the least used of the formats however as broadband becomes more prevalent their use can be expected to increase.