ITGS students are required to understand common image file formats. You should be able to:
- State the most common formats.
- Describe the features of these formats.
- Select an appropriate file format for a specific situation.
- Distinguish between lossy and lossless compression.
Common image file formats
Image file formats are relatively straightforward. There are only two major image file formats used on the web these days (JPEG and PNG), plus two or three others it is worth knowing about.
JPEG: A lossy file format best suited to photographs and similar images. As with all lossy formats, some quality is lost when JPEGs are compressed. The advantage is the significant file size reduction.
PNG: A lossless format best suited to cartoon style images, diagrams, and other images with large blocks of continuous colour. Compression is less efficient than lossy formats, but quality is maintained.
GIF: Although the Graphics Interchange Format is obsolete for storing images, it is still quite widely used. This is mainly because it can be used to create simply animations (animated GIFs).
TIFF (or TIF): The Tagged Image File Format is typical not used on the web. It is a more general purpose format often produced by scanners and image editing applications. TIFF uses either lossless compression or no compression. A key advantage of TIFF is that it supports 16 bit colour. You may be surprised to know that JPEG only supports 8 bits per colour channel for a total of 24 bits (red, green, blue). This allows TIFF to store a wider range of colours.
WEBP: A relatively new file format being developed by Google. It offers both lossy and lossless compression. Google claims file sizes average about 26% smaller than JPEGs. The drawback is that not all web browsers currently support webp yet. This means web developers who want to use webp still need to provide an alternative JPEG version of each image, just in case.
Lossless vs lossy compression
Lossless and lossy compression are two key terms you must understand. Lossless compression tries to reduce file size by looking for repeated patterns of data and re-writing them in a shorter form. The original data can always be recovered. Lossy compression takes this a step further and discards data in an attempt to make the file even smaller. “Hopefully” you won’t notice that data has been discarded, as it cannot be recovered. Lossy compression is always a trade-off between quality and file size.
You can see the same JPEG image compressed at different quality settings below (click the images for a larger version):
Note: Although it is generally stated that JPEG is the preferred format for photographs, professional photographers would never use JPEG for storing their original images. Instead they would use a lossless format. This guarantees they have the absolute highest quality version available – which they can then export to JPEG after processing.