Image Formats & File Compression

In order to fit more images on a memory card, your camera may be compressing the images. This can have an effect on the quality of the images being stored, which is why image compression is often referred to as "image quality" in camera settings and editing dialogues. It is important to have an understanding of the different image formats available, and their effect on image quality.

The image formats discussed here are of particular interest to digital photographers:

RAW Images

RAW images are images that are stored in the camera's own, native format. These images are not compressed and therefore take up a lot of room on the memory card. The advantage to serious photographers is that they contain all of the information that the camera was able to capture without any loss or compromise.

The first disadvantage is, as already mentioned, the large amount of space they require on the memory card. For example, the table below shows a comparison of a number of 10 megapixel images captured and stored using both the Panasonic RW2 RAW format and a high quality JPEG format.

Image Name JPEG Size RAW Size
P1430022 2.10 11.70
P1430023 1.99 11.70
P1430024 1.32 11.60
P1430025 1.51 11.70
P1430026 1.65 11.70
P1430027 1.52 11.70
P1430028 1.50 11.60

First, notice the large size difference between the equivalent JPEG and RAW format images. The JPEGS are between 18% and 11% of the size of the RAW, meaning that you could store as much as 5 times as many JPEGS on the same memory card! But also, notice the difference in size difference! The RAW files are nearly all the same size, whilst the JPEGS vary quite a lot in size. Some JPEGs at this image size are actually much bigger than shown in this sample. This is becase a JPEG applies varying amounts of compression depending on the actual content of the image whilst a RAW image simply records everything.

The second, far more serious, disadvantage is that each camera manufacturer has their own RAW format which is different to, and incompatible with, the RAW format from other manufacturers. This means that special software is often requried to process a RAW file before it can be edited in Photoshop. Fortunately, Adobe provide a plug-in which is capabale of reading the RAW files from many different cameras for you, enabling you to import a RAW image for editing.

In an attempt to help promote interoperability, Adobe have developed a format called Digital Negative (DNG) that aims to provide a cross-platform compatible format for RAW image capture. However, support for this format has not been particularly strong amongst camera manufacturers.

An alternative approach to DNG is the OpenRAW project. This also contains a good analysis of the potential problems of relying on RAW files for archiving images. However, this project has achieved even less momentum. It would seem that there is not much real interest in solving this problem.

Note that most consumer level cameras and even some bridge cameras do not support a RAW format and only record images as JPEGs.

JPEG Images

In addition to RAW, most cameras will also store images in the JPEG format. JPEG stands for Joint Photographic Experts Group, which is the organization that created the file format. In order to fit more images in the camera's memory, a JPEG image is compressed so that they take up less room.

However, the JPEG image format uses lossy compression. This means that some of the information in the image is thrown away when it is compressed. The JPEG technique tries to only discard information that the human eye would not notice. Therefore, at a reasonably quality in most images, you will not notice the effect of the JPEG compression on your pictures.

JPEG Save DialogThere is a potential for confusion in terminology here. Some systems talk about "compression levels" and some systems talk about "quality settings". Just remember that a high quality image has a low compression level (and will therefore be a larger file), whilst a low quality image has a high compression setting (and will therefore be a smaller file).

The image on the right shows the JPEG format save dialog in Photoshop. Notice the different ways you can set the quality in the Image Options section: you can set a numeric value, with 12 being best; you can use the drop-down to use a descriptive setting such as "Maximum" or "Medium" etc; or you can use the slider to set a file size. At the right of the dialog is an approximate indication of how big the resulting image file will be.

As an example of the effect of JPEG compression on image quality consider the images below. The original size of the whole image, at maximum quality, was 4.98Mb. Saved at minimum quality (or maximum compression) the size of the image reduced to only 541Kb. That is, the lowest quality image is only 10% of the size of the maximum quality original. This is a huge saving in the storage needed. However, to see the effect this would have on quality, consider the two examples shown below:

Maximum Quality Minimum Quality
Maximum Quality
Minimum Quality

The image on the left shows a portion of the picture saved at maximum quality, the image on the right saved at minimum quality. Both of these images show the actual pixels. Notice the loss in quality on the edges and the blurring in the texture on the stone. For most photographers this reduction in image quality is not acceptable.

Finally, note that, because a JPEG image is recompressed every time it is saved, if you repeatedly open and resave a JPEG image you will eventually degrade the quality. Therefore, you should not work extensively on JPEG images. Instead, you should save the image in your editor program's own format (see the section about PSD images below).

TIFF Images

The name TIFF is taken to stand for Tagged Image File Format. It is currently under the control of Adobe Systems. Some cameras offer the option to save images in this format.

Photoshop TIFF DialogueThe advantage of TIFF is that there are a range of compression techniques available and some of the compression techniques are not lossy (this means can be compressed without any loss in image quality).

The dialogue on the right shows the options Photoshop provides when saving an image as a TIFF. There are four compression options offered and it is interesting to compare their results.

If the NONE option is selected, then no compression is applied to image when it is saved. The LZW option refers to the Lempel-Ziv-Welch compression algorithm, which is a lossless compression technique. The ZIP option uses the same lossless compression technique as in ZIP archive files. Note that this format is not supported in older versions of TIFF. Finally, as you might expect, the JPEG option uses the same lossy compression algorithm as JPEG.

The following table shows the resulting image sizes for an image saved as a TIFF file with different compression formats. Note that the JPEG compression version was saved at maximum quality.

Compression File Size (Mb)
NONE 28.5
LZW 14.6
ZIP 12.7
JPEG 6.1

For comparison, the actual JPEG version of the image has a size of 5.7Mb and a basic Photoshop PSD file of the same image (see below) has a size of 28.5Mb.

For a more comprehensive comparsion of LZW and ZIP compression results in TIFF files see this Have Camera Will Travel article.

PSD Images

A PSD image is a proprietary format used by the Photoshop application. It stands for "Photoshop Document". If you are using Photoshop to edit and manipulate your images, you should save your master copy of the image using this format and only export to some other format (as discussed above) when you need to.

One advantage of this format is that, compared to JPEGs, it does not introduce any loss of quality due to compression. However, the main reason to use this format is the use of layers when editing. If you save the image in any other format, any layers you have created will be merged and lost. If you save in PSD format, then all the layer information is saved and you can work with all the layers again when you open the image.

Note that each image processing application has its own proprietary format. For example, the GIMP (GNU Image Manipulation Program) saves its images as an XCF files. However, because the Adobe PSD format is so common, GIMP can also read these files, even if it cannot replicate all of Photoshop's functions.

Other Image Formats

There are many other image formats that are available, but most of them are not of particular interest to digital photographers.

You can read about some of the other formats used in web design, such as GIF and PNG, here...

Summary

The main use of RAW image files is to ensure maximum quality during the image capture process. Once the image has been uploaded to your computer for processing, it is usually converted into another format for editing.

If you are using Photoshop, the PSD format is the best format to save your images in while you are actually editing them. If you are using a different editing application, you should save them in the native format of the particular application. This gives you the most flexibility while you are still working on your image. Once you have completed your edits, you should export the image in a more commonly used format.

JPEG images are mainly used for the display of photographs on the Internet. The fact that most browsers do not support a wide range of images coupled with the small size of JPEG images makes them ideal for downloading in web pages. Also, many print services specify that the images submitted for printing should be in the JPEG format.

The main use of a TIFF file would probably be to provide a high quality lossless image that could be viewed by anyone independantly of the editing software that you might have used to create the image. In that case, you would save the image using either LZW or ZIP compression options. There isn't really much point in saving a TIFF image using JPEG compression - you might as well just use the JPEG image format directly.

Links

You can find additional information about image compression at the following pages:

Back...back to the theory index