The advantages and disadvantages of the raw format generate a lot of interest. People may have heard that raw produces a higher quality image than JPEG. Others may have heard rumors that raw processing utilizes a complicated workflow. Yet, beyond this, raw may seem like a mystery to many. However, to those knowledgeable about raw, there is nothing mysterious about it. Raw has certain advantages, as well as disadvantages, over other photographic file formats for very specific reasons that can be traced back to the photographic equipment and processes. By understanding these advantages and disadvantages, and the reasons for them, photographers can make intelligent decisions about whether utilizing raw makes sense for their applications.
This article will deal with two questions:
Specifically, this article will deal with the advantages and disadvantages of raw as compared to JPEG. This is because JPEG is the primary alternative to raw.
To understand what raw is all about, we first need to understand a little about what is inside of a digital camera and what the camera must go through to produce an image.
Within each digital camera is little chip called a sensor. Despite its small size, this sensor is the most expensive and complicated part of the entire digital camera. The sensor is the device that collects and processes the light that is used to create an image; it takes the place of the film that is used in traditional cameras. Each sensor is composed of an array (rectangle) of tiny pixels (photodiodes). Each pixel is composed of a light sensitive semiconductor material.
Figure 1 shows a greatly simplified diagram of a pixel. Light, in the form of photons (tiny packets of light) arrives at the pixel. The light from a slightly larger area than the active part of the pixel is focused by a microlens. The light then passes through a color filter array (also known as a Bayer filter, more about this later). Finally, the light enters the pixel. At this point, the light interacts with the semiconductor material of the pixel to create an electrical charge.
The pixel now has an electrical charge. Of course, the same thing was happening with all of the other pixels in the sensor. For example, in the case of a six megapixel camera, there would be approximately six million pixels, each with its own electrical charge, waiting to be processed into a beautiful image.
Now that the pixels have all those electrical charges, the work of processing those charges into meaningful information that can be used to create an image begins. Figure 2 shows a simplified flowchart of the raw process and subsequent processing. Figure 3 shows a simplified flowchart of the JPEG process.
Let's go over the steps, in Figure 2, that create a raw file.
Now the question, "What is raw?" can be resolved. An analysis of Figure 2 will reveal the answer. The raw process ends at step 6. At this point, the data from the sensor has been converted into digital format -- that is all. An important point is that the data is still in rather pure form. Only minimal processing has been performed to convert the pixel information into digital format. No other processing has occurred -- no colors have yet been assigned by Bayer interpolation, no white balance has been assigned, and no tonal curve has been applied.
Figure 2 also dispels a raw myth. It is sometimes said that raw data is the data straight from the pixels with no processing at all performed. This is incorrect. The data straight from the pixels is unamplified, analog, voltage data. Raw converters can not even read this data. It must first be amplified and converted to digital before it is ready for raw output.
We can now look at the steps, in Figure 3, that create a JPEG file (the steps in red are the same as raw processing).
It can be seen that Steps 1 -- 6 are the same as for a raw file. While steps 7 -- 9 are similar, they are performed in the camera for JPEG files while the steps are performed in a raw converter for raw files. Step 10 is also performed in camera for JPEG (raw files can be sharpened either in the raw converter or an image editing program). Step 11 is unique to JPEG files.
An analysis of these two processes should lead to an understanding that the raw process creates a relatively elemental file that has had very minimal processing and that requires additional processing to produce an image while the JPEG process creates a more finished file that has had a significant amount of processing.
One of the biggest advantages of raw is flexibility.
When a photographer shoots JPEG, the white balance, tonal curve, sharpening, compression, and other choices are essentially burned into the file. The sharpening and compression are irreversible (you can blur the JPEG image to reduce the sharpening, but that is not the same as undoing the sharpening and it will degrade the image). Color and tonal problems created by improper white balance or tonal curve can be adjusted somewhat in a JPEG file, but it will cause some degradation of the image. The problem arises because the camera sets these parameters into the image at the time the photo is taken. Making changes to these parameters at a later time can be difficult (e.g., loss of detail in the shadows due to the use of a contrasty tonal curve) or impossible (e.g., undo file compression).
On the other hand, for raw files, the white balance and tonal curve are handled in the raw converter (sharpening can be handled in the raw converter or in an image editing program). The photographer sets the parameters at the time of conversion. If the photographer decides to use a different setting, she can simply change the setting and reconvert the image (e.g., if the image had a loss of shadow detail due to a contrasty tonal curve, the photographer could simply reconvert the file with a less contrasty curve). In fact, she can reconvert the image as many times as she wishes with different settings. There will be no degradation of image quality because the original raw image is never changed. Every time a conversion is performed, a new file is created that has all of the settings incorporated into it. Thus, white balance, tonal, and sharpening issues can be more easily dealt with in raw.
It is often said that raw offers quality advantages over JPEG. This is a true statement. There are a number of reasons for this. However, by far, the biggest reason that raw has a quality advantage over JPEG has to do with bits. If you are not familiar with digital numbers, I suggest that you read the "Digital Numbers box before proceeding further.
JPEG files are eight bit. That means that each pixel can register 28 = 256 levels of light intensity. In other words, each pixel can render 256 shades. Traditionally, 0 represents pure black and 255 represents pure white. As you go from 0 to 255, the shades go from dark to light. Previously, it was mentioned that some pixels measured red light, some green, and some blue. Therefore, there are 256 possible shades of red, 256 of green, and 256 of blue. When the Bayer interpolation does its magic to calculate a color for each pixel, it uses the color information for the pixel and its neighboring pixels. Since the interpolation is using information from all three colors, there are 2563 = 16,777,216 possible colors with an eight bit JPEG file. That sounds pretty impressive -- until you compare it to raw.
Most raw files are twelve bit (for the sake of simplicity, the rest of this series of articles will assume the raw files that are being discussed are 12 bit). That means that each pixel can register 212 = 4,096 levels of light intensity. Now, when the Bayer interpolation does its magic, there are 4,0963 = 68,719,476,740 possible colors. That is 4,096 times more colors than JPEG!
It turns out that the human eye can only see about 16,000,000 colors -- about what the JPEG file has. In other words, the human eye can not tell the difference between many of the extra colors that raw produces. So, if we can not see all the extra colors that the raw format produces what's the big deal about raw producing better quality images? Well, it turns out that the sensor in the camera that you paid so much for pulls a dirty, little trick on you.
The little trick is that most digital camera sensors are linear devices. What that means is that when the amount of light that reaches a sensor is doubled, the output of the sensor is doubled. That sounds innocuous enough. Actually, it causes some major issues, especially for JPEG. The problem starts to reveal itself when we look at bits in conjunction with the dynamic range of the sensor. Dynamic range is a measure of the span of tonal values over which a device (in this case a sensor) can hold detail. In other words, it is the tonal distance from the darkest point at which the device holds detail to the lightest point. Dynamic range is measured in stops of light. When light is increased by one stop, the amount of light is doubled (going in the other direction, it is cut in half). For instance, a photographer may say that he doubled his exposure by opening up the lens by one stop.
At the current time, the sensors in the better digital cameras have a dynamic range of about five to six stops. For our purposes, we will assume that you have a camera with a dynamic range of five stops. The shades that an individual sensor can render in a file must be spread across those five stops. The problem is that those shades are not spread evenly across the dynamic range of the camera.
As we move on to analyze the next pixels in Figure 4, the key to understanding what is happening is to remember that each time the exposure is reduced by one stop, the light is reduced by half. Since sensors are linear devices, when the light is reduced by half, the sensor will only be able to render half as many shades.
Now, suppose that pixel B in Figure 4 received its light from an area in the scene that was somewhat darker. For our example, the pixel would be given four stops of light (half as much light as pixel A). Since sensors are linear, and Pixel B got only half as much light, it would be able render only half as many shades. Thus, the data from pixel B would be able to render only 128 shades. Since pixel A’s five stop exposure rendered 256 shades, and pixel B’s four stop exposure rendered only 128 shades, the fifth stop of light was responsible for rendering the other 128 shades. In other words, the brightest stop of dynamic range (the fifth stop) used up half of all the available shades.
The procedure repeats itself with pixel C. The light is reduced by one more stop so that the pixel receives three stops of light. Since pixel C receives only half as much light as pixel B, it would be able to render only half as many shades. Accordingly, pixel C would render 64 shades. Since pixel B’s four stop exposure rendered 128 shades, and pixel C’s three stop exposure rendered only 64 shades, the fourth stop of light was responsible for rendering the other 64 shades as shown in Figure 4. In other words, the second brightest stop of dynamic range (the fourth stop) used up one fourth of all the available shades.
At this point, we can see that the two brightest stops in a five stop dynamic range camera render 75% of all the shades the camera is capable of producing. Pixels D and E in Figure 4 show that, as we continue to work down the dynamic range, the camera is capable of rendering less and less shades. Eventually, one stop of light is reached. This last stop of light is capable of rendering only 16 shades.
The exact same process can be carried out for a pixel that will output is data into a raw file. The difference is that the raw processing leaves the data as 12 bits (rather than changing it to 8 bits like JPEG). Thus, a pixel that reached its full well capacity and has its data processed as raw starts off with 4,096 shades. Table 1 summarizes the distribution of the shades across the dynamic range for both JPEG and raw files.
|Three quarter tones|
As can be seen from the chart, the shades of color are not evenly distributed over the five stops of dynamic range. More of the shades are allocated to the brightest areas, and far fewer shades are allocated to the darker areas. The news is not good for the JPEG user. The pixels that were exposed to only one stop of light rendered only sixteen shades for the shadow areas in the JPEG image. On the other hand, the raw user got 256 shades allocated to the shadows.
What this means is that the JPEG file has fewer shades of each of the three colors with which to create shadow detail than the raw file. This problem now gets compounded by the human visual system. While the sensor may be a linear device, the human visual system is not. The human visual system is more sensitive to some amounts of light than others. In Particular, the human visual system is more sensitive to shadows than highlights. What this means is that increasing the amount of light in a shadow area will register a larger impact on the visual system than increasing the amount of light, by the same percentage, in the highlights. We now have a situation where we have the least amount of data in the area where the visual system is the most sensitive, and this problem is the greatest for the JPEG user.