Visit just about any photography forum and you’re bound to come across a debate over the respective merits of RAW and JPEG files. One of the reasons that some photographers favor the RAW format is because of the extra bit depth contained in the file. This lets you take photos of a higher technical quality than you can obtain from a JPEG file.
What is bit depth?
Computers (and devices that are run by built-in computers such as digital SLRs) use the binary number system. Binary numbers are constructed from two digits – 1 and 0 (the decimal system by contrast has ten numerals). A single digit in a binary number is called a bit (shortened from ‘binary digit’).
An eight bit binary number looks like this: 10110001 (equal to the decimal number 177). The table below shows how it works.
The highest possible eight bit number is 11111111 – or 255 in decimal notation. This is a significant figure to photographers since it crops up in many image editing programs and on old monitor displays.
Each of the millions of pixels in a digital photo corresponds to a photosite (also called a pixel) on the camera’s sensor. Photosites generate a small electric current when hit by light, which is measured by the camera and recorded in a JPEG or RAW file.
JPEG files record the color and brightness information for each pixel with three eight bit numbers, one for each of the red, green and blue channels (these color channels are the same as the ones you see in programs like Photoshop or in your camera’s color histogram display).
Each eight bit channel records colour on a scale of 0-255, giving a theoretical maximum of 16,777,216 tones (256 x 256 x 256). The human eye can detect somewhere between 10 and 12 million colours, so this is more than sufficient information to record any subject.
This gradient has been saved in a 24 bit file (eight bits per channel), enough to render a smooth gradient.
This gradient has been saved as a 16 bit file. As you can see, 16 bits is not enough to render a smooth graduation.
RAW files dedicate more bits to each pixel (most cameras have 12 or 14 bit processors). More bits means larger numbers and more tones per channel.
This doesn’t equate into more colors – JPEG files can already record more colors than the human eye can see. But each color is recorded with a much finer tonal graduation. The image is said to have greater color depth. The table below shows how bit depth equates into tones.
When you set your camera to record photos in JPEG mode, the camera’s internal processor reads the information gathered from the sensor when you take a photo, processes it according to the parameters set in the camera menu (white balance, contrast, colour saturation etc.) and records it as an eight bit JPEG file. The ‘extra’ information gathered by the sensor is discarded and lost forever. In the end, you are only using eight bits out of the 12 or 14 bits of detail that the sensor is capable of capturing.
A RAW file is different from a JPEG because it contains all the data captured by the camera’s sensor during the exposure. When you process a RAW file using RAW conversion software, the program is carrying out a similar conversion to that of the camera’s internal processor when you shoot JPEG. The difference is that you set the parameters within the program you are using, and the ones set in your camera’s menu are ignored.
The benefit of the extra bit-depth of the RAW file becomes apparent in post-processing. A JPEG file is all you need if you got exposure and all the other settings spot on when you took the image, and you don’t want to do any post-processing.
However, in real life most of us want to carry out at least a few adjustments, even if it’s just to the brightness and contrast. That’s where JPEG files start to fall down. With less information per pixel, the tones can separate as you carry out adjustments to brightness, contrast and color balance.
The result is most pronounced in areas of smooth continuous tone such as blue skies. Instead of an even graduation from light to dark, you’ll see banding patterns. This effect is also known as posterisation. The further you push the adjustments, the more the image is affected.
With a RAW file, you can make much greater changes to brightness, contrast and colour tone before you see any breakdown in the image quality. It also enables some of the features that you find in RAW conversion software, such as white balance adjustment and highlight recovery.
This photo originated from a JPEG file. Even at this size there is visible banding in the sky as a result of the post-processing.
A close-up look at the sky shows the posterisation effect. Working with a 16 bit TIFF file would have eliminated, or at least minimised, the banding effect.
16 bit TIFF files
When you process a RAW file, your software gives you the option to save it as an eight bit or 16 bit file. If you are happy with the edit and don’t wish to make any more changes, you can save it as an eight bit file. You won’t notice any difference in quality between an eight bit and a 16 bit file on your computer monitor, or when you print the image out. The only exception is if you have a printer that recognizes 16 bit files. In this case, a 16 bit file may produce a better result.
However, if you plan to carry out further post-processing in Photoshop, then it’s advisable to save the image as a 16 bit file. In this case, an image that originated from a 12 or 14 bit sensor is ‘stretched’ to fill the 16 bit file. You can then work on it in Photoshop, knowing that the extra bit depth will help you obtain maximum quality.
Again, when you have completed the editing process, you can save the file as an eight bit file. Magazines, book publishers and stock libraries (and just about any client purchasing photos) require eight bit images. 16 bit files may only by required if you (or someone else) intends to edit the file.
This is an image that I took using the RAW+JPEG setting on an EOS 350D camera. The camera saved two versions of the file – a JPEG processed by the camera’s processor, and a RAW file containing all the information recorded by the camera’s 12 bit sensor.
This compares the top right hand corner of the processed JPEG and RAW files. Both files were created by the camera from the same exposure and the only difference between them is the bit depth. I was able to pull back highlight detail in the RAW file that isn’t visible in the JPEG. If I wanted to work on this image further in Photoshop, I could save it as a 16 bit TIFF file to retain the maximum possible image quality throughout the editing process.
Why photographers use JPEG
It’s worth noting that not all professional photographers use the RAW format all the time. Both wedding and sports photographers, for example, often use the JPEG format.
For wedding photographers, who may shoot thousands of images at a wedding, this is to save time in post-processing.
Sports photographers use JPEG files so that they can send photos to their picture editors during a sports event. In both cases, the speed, efficiency and smaller file size of the JPEG format makes it the logical file type to use.
Bit depth in computer screens
Bit depth also refers to the depth of color that computer monitors are capable of displaying. It may be difficult to believe for readers who are used to modern displays, but the computers I used at school could display just two colours – white and black. The ‘must-have’ home computer at the time was the Commodore 64 – capable of displaying 16 colours. According to Wikipedia, this computer sold over 12 million units.
Commodore 64 computer – photo by Bill Bertram
Clearly, you can’t edit photos on a machine with 16 colors (the 64 kilobytes of RAM wouldn’t have gone very far either) and the development of 24 bit true color displays is one of the things that made digital photography possible. True color displays are, like JPEG files, generated from three colors (red, green and blue) each with a possible 256 values recorded in an eight bit digit. Most modern monitors use either 24 bit or 32 bit true color graphics.
Many of you know that high dynamic range (HDR) images are created by combining two or more versions of the same image taken with different exposure settings. But, did you know that the software creates a 32 bit image with over four billion possible tonal values per channel per pixel – quite a jump from the 256 tonal values in a JPEG file.
True HDR files such as this can’t be displayed on a computer monitor or the printed page. Instead, they are reduced to either eight or 16 bit files by a process called tone-mapping, that retains the characteristics of the original high dynamic range image.
Pixels and bits are the basic building blocks of digital images. If you want to get the best possible image quality out of your camera, it’s essential to understand the concept of bit depth and the reasons that the RAW format produces the best quality image.