Why Raw -- Part II

Article and Photography by Ron Bigelow


Raw Advantage #3: Tonal Curves

Figure 1: Image before Application of Tonal Curve

Even after the data has been digitized and white balance adjustments made, the image is still not yet ready to be used to create an image. At this point, the image is very dark and has low contrast. Figure 1 shows an image at this stage in the process. As can be seen, the image is barely recognizable. In order to make the image useable for further processing, a tonal curve is applied to the information (this is a similar concept to the curves used in photo editing applications). This curve serves two primary purposes. First, the curve lightens the image. This makes the detail in the image recognizable. Second, most curves alter the tonal distribution of the image.

Figure 2: Image after Application of a Standard Tonal Curve

After the image in Figure 1 has had a tonal curve applied, it appears as shown in Figure 2. The details of the waves and rocks can now be seen (Please note that the images in this section are not finished images. They have only been converted. They would now undergo significant processing in Photoshop (or another image editing program) before they would be ready to be printed).

The step of applying the tonal curve gives the photographer shooting raw some advantages. One advantage has to do with the shape of the tonal curve. When converting images in a raw converter, the photographer has a choice of two types of conversions (linear and nonlinear). The most commonly used conversion type is a nonlinear conversion. With this type of conversion, the raw converter applies the tonal curve during the conversion. However, most raw converters give the photographer a choice of several different tonal curves. For instance, one of the converters that I use gives me a choice of four different tonal curves. Furthermore, many photographers own more than one converter. If the tonal curves in one converter don't suit the needs of the photographer, she can choose one of the other converters.

Figure 3: Image after Application of an Alternate Tonal Curve
The advantage here is that the photographer can choose the tonal curve that will best optimize a particular image. One tonal curve can be selected when it is desired to emphasize the shadows, another when the highlights need detail, another when the contrast needs to be increased, and so on. This advantage can be seen by conducting a close examination of Figures 2 and 3. Figure 2 was converted with the standard tonal curve in a raw converter. Figure 3 is from the exact same raw file; however, the image was converted using one of the alternate tonal curves offered by the raw converter.
Figure 4: Histogram of Image 2 (Standard Tonal Curve)
Due to the small size of these images, and depending on the quality of your monitor, the images may appear to be almost the same. Nevertheless, there is far more to it than would at first appear. A look at the histograms of these two images begins to tell the true story.
Figure 5: Histogram of Image 3 (Alternate Tonal Curve)

Figure 4 shows the histogram from the image in Figure 2 (the image converted using the standard tonal curve). Figure 5 shows the histogram from the image in Figure 3 (the image converted using the alternate tonal curve). At first, the histogram in Figure 4 might appear fine with the exception that the image needs to be adjusted at the dark end to increase the contrast of the image (these images were exposed using the maximum exposure method to maximize the SNR). However, a look at Figure 5 reveals a disturbing problem. Figure 5 reveals information at the right end of the histogram that is not there in Figure 4 -- there is highlight detail in Figure 5 that does not exist in Figure 4. In short, the standard curve clipped (destroyed) some of the highlight detail that existed in the raw file. This detail was captured in Figure 3 by changing to one of the alternate tonal curves during the conversion. It can also be seen that the alternate tonal curve slightly changed the shape of the rest of the histogram.

This loss of detail can be seen in Figures 6 and 7. Figure 6 is a crop from Figure 2 that shows a close up of a wave crashing against one of the rocks. Figure 7 shows a crop of the same area from Figure 3. A close look at the portion of the images in the red ovals will reveal subtle detail in Figure 7 that has been lost in Figure 6 (this is assuming that your monitor is good enough to demonstrate the difference).

Figure 6: Close up of Figure 2 (Standard Tonal Curve)
Figure 7: Close up of Figure 3 (Alternate Tonal Curve)

It is important to understand that Figure 2/6 did not lose detail because it was overexposed. Figure 2/6 was generated from the same raw file as Figure 3/7; thus, it had the same exposure. The difference was due to the tonal curve applied at the time of conversion. By having an option of which tonal curve to apply, the raw shooter can optimize her images.

As mentioned above, when converting images in a raw converter, the photographer also has the option of performing a linear conversion. This is another advantage over JPEG. A linear conversion provides for the ultimate in optimization of tonal curves. With a linear conversion, the converter does not apply any tonal curve at all during the raw conversion process. The image will come out dark as in Figure 1. This allows the photographer to apply a completely customized tonal curve in Photoshop. In this case, the photographer has the freedom to specifically design the tonal curve to optimize the image in the way that best suits the image and the intentions of the photographer.

Whether choosing a nonlinear or linear raw conversion, the key is that the photographer has a significant degree of flexibility in applying the tonal curve.

On the other hand, when shooting JPEG, the photographer abandons much of this flexibility and turns over control of the tonal curve to the camera. In the case of JPEG, the camera will apply a tonal curve that has been predetermined. Most digital cameras now allow the photographer a choice of more than one tonal curve. Many give a choice of a normal, low, or high contrast tonal curve. While this offers some flexibility, it is usually less than that of the photographer performing a nonlinear raw conversion (especially if he owns more than one converter) and considerably less than that of the photographer performing a linear conversion. In addition, when a photographer shoots raw, he always has the option of changing the tonal curve and reconverting the image -- if one curve does not create what he wants (as occurred with the clipped highlights in Figure 2), he can always go back and choose a different curve. This option is lost when shooting JPEG. When a photographer shoots JPEG, the camera essentially burns the tonal curve into the file.

Another issue that the photographer using JPEG must deal with is that some digital cameras use a contrasty tonal curve. As a result, the curve can clip the detail in the shadows, the highlights, or both. The photographer shooting raw does not have this problem. As long as the pixels captured the detail, the settings can be adjusted in the raw converter to avoid clipping of the shadow and highlight detail that may occur if the JPEG format is used.

In addition to lightening an image, most tonal curves lighten the dark areas more than the light areas. As covered in Part I of this article, the human visual system is more sensitive to shadows than highlights. By lightening the dark areas more than the light areas, the tonal curve makes the image match much more closely with the way the human visual system works. This makes the image appear more natural. This also alters the distribution of shades in an image. Table 1 from Part I of this article is redisplayed to show the distribution of shades, for both raw and JPEG files, before any tonal curve has been applied.

Table 1: Distribution of Shades for a Five Stop Dynamic Range Prior to Application of Tonal Curves (i.e., Gamma or Transfer Function)
5 Stops
4 Stops
Three quarter tones
3 Stops
Mid tones
2 Stops
Quarter tones
1 Stop
Table 2 shows one common distribution of shades, for a JPEG image, after the application of a tonal curve. It is important to note that this is not the only distribution possible. The actual distribution will depend on which tonal curve is applied in the camera.
Table 2: One Possible Distribution of Shades, for JPEG, for a Five Stop Dynamic Range after Application of Tonal Curve (i.e., Gamma or Transfer Function)
5 Stops
4 Stops
Three quarter tones
3 Stops
Mid tones
2 Stops
Quarter tones
1 Stop

As can be seen in Table 2, the tonal curve redistributes the shades by allocating more to the shadows and quarter tones and reducing the number of shades in the lighter areas. This is a good thing for JPEG since JPEG images have a limited number of shades in the shadow areas. It can also be noted that the total number of shades is reduced (from 256 to 203). This is due to quantization error (covered in the next section). Luckily, the loss of shades occurs primarily in the lighter areas of the image where there is a much larger number of shades and where human perception is less sensitive.

The same redistribution of shades happens when a tonal curve is applied to a raw file. While the number of shades in the shadow areas will increase, it is not quite as important for the raw process since there are many more shades to begin with than for a JPEG image.

Raw Advantage #4: Bits vs. Posterization  

A concern with JPEG images is that the smaller number of shades in a JPEG image forces the shades to be much farther apart than in a raw image. Further processing could force these shades even farther apart or can leave some of the shades empty creating gaps between adjacent colors. In some cases, this can become visible to the eye in the form of posterization. When posterization occurs, the human eye can detect the change from one color to another. This results in a loss of detail and banding. This is most noticeable in areas of little detail. For instance, featureless skies may show banding of colors. Posterization is much less of a problem with raw images because the increased number of shades causes the shades to be much closer together.

Figure 8: 8 bit JPEG with Posterization

Figure 8 shows a crop from an image that was converted from a raw file into an 8 bit JPEG file. Figure 6 is a crop from an image that started with the same raw file, but the file was converted into a 12 bit TIFF file (actually, the Photoshop file is 16 bits, but the last 4 bits have no data). Then, both images received the exact same manipulations in Photoshop.

Figure 9: 12 bit TIFF without Posterization

Figure 8 shows the posterization that is the result of having only 8 bits in the JPEG file (whether you can see the posterization will depend on how good of a monitor you have). On the other hand, Figure 9 shows no significant posterization due to the fact that the TIFF file has 12 bits.

Clearly, the 12 bit raw process has advantages over the JPEG process due to the larger number of bits in the raw file. This advantage is due to the issue of quantization error. When a photographer works on an image in Photoshop, she thinks in terms of colors and details, but Photoshop thinks in terms of numbers and mathematical formulas because all of that color and detail have been converted into digital numbers. When editing is performed, Photoshop runs the digital numbers through formulas to determine the new numbers. However, the new numbers have to be rounded off to the nearest digital number (e.g., a new shade of 157.43 would be rounded to 157). The information that is rounded off is thrown away forever. Thus, information is lost in the rounding process. This results in quantization error -- which results in image degradation. For example, quantization error can result in a reduction in the number of shades in an image (e.g., two shades may round off to the same value; thus, two shades merge into one shade -- detail is lost). Since raw files have many more shades than JPEG, the distance between the shades is much smaller in raw. Consequently, quantization error is less of an issue for the raw process.

Raw Advantage #5: The Raw Converter Advantage

In order to understand this advantage, it must be kept in mind that JPEG images start out life as raw data. JPEG files are first processed in the camera (further processing may be performed in Photoshop). The conversion from raw to JPEG occurs during this in-camera processing. Thus, JPEG files are converted using the camera's converter.

Not all raw converters are created equal. Some are much better than others. In general, raw converters that run on computers (e.g., Adobe's Camera Raw and Phase One's C1) are superior to in-camera converters. Table 3 shows why. The CPU (computer) inside the camera is very weak compared to the CPU in a high end computer. The in-camera CPU was designed with a lot of constraints in mind (e.g., it must be small and light, it can't use a lot of power, it can't generate a lot of heat, and it can't be too expensive). The computer CPU has far less constraints (e.g., it can deal with heat by the use of a fan; some computers even have liquid cooling). Thus, the computer CPU is far more powerful. The in-camera CPU has limited resources (e.g., memory). The computer CPU's resources are far greater (limited only by the owner's budget). The in-camera CPU has to run on a small, low voltage battery. The computer CPU runs on a 120V power source (notebooks can run on a battery, but they will then be slower than a desktop of similar configuration). The in-camera CPU must carry out the conversion very quickly; photographers do not want to wait a long time while the camera processes images. The computer has much more time to carry out the conversion. Consequently, the in camera converter must use much simpler algorithms to carry out the conversion. On the other hand, raw converters that run on computers can use much more sophisticated algorithms. This will usually allow them to produce files with more detail than those converted in the camera.

Table 3: Raw Converter Comparison
(In-Camera Vs. Third Party)
Third Party
Small and weak
Resources (e.g., memory)
Very limited
Few limitations
Power source
Small low voltage battery
120 volt wall power or battery
Must process fast
Can take much more time

Again, the advantage goes to raw. While JPEG files are converted in-camera, raw files are converted in the computer with more advanced converters.

A note is appropriate here. There are no images comparing an image converted in camera to one converted with third party software because it would be impossible to separate the differences due to the converters from the differences caused by the other factors covered in this series of articles.

Raw Converter Advantage #6: Compression

Compression, in relation to photographic files, refers to the process of throwing out or compressing data in order to make the file size smaller. Raw files are either not compressed or use a lossless compression (no data is lost). Therefore, no data is thrown away. Nevertheless, the raw files are very compact to begin with. Raw files have not gone through Bayer interpolation in order to create the color information. Consequently, raw files have only one channel. This channel indicates the light intensity at each pixel (kind of like a black and white image). Since the raw format is 12 bits, each pixel in a raw file contains 12 bits of data.

JPEG files have gone through the Bayer interpolation in the camera. Thus, JPEG files have three channels to record the color information (one channel for red, one for green, and one for blue). Since JPEG files are 8 bits per channel, and there are three channels, each pixel in a JPEG file contains 24 bits of data. Accordingly, JPEG images have twice as much information per pixel as raw files despite the fact that raw files are 12 bits versus JPEG's 8 bits per channel. The only way that JPEG files end up smaller than raw is by compressing the data.

There are two general types of data compression: lossless and lossy. Lossless compression has the advantage that no data is lost. So, lossless compression does not degrade the quality of images. The downside of lossless is that it can not be compressed as much as lossy. Lossy compression can make images smaller than lossless, but at the cost of image degradation. JPEG files use lossy compression. Thus, the JPEG files tend to be small, but they also suffer image degradation (the greater the compression, the greater the degradation).

JPEG compression goes through a number of steps to reduce the file size. First, the file is changed from an RGB model to a luminance/chrominance model (one channel of tonal information and two channels of color information). Second, the compression algorithm breaks the image into 8 pixel by 8 pixel squares (JPEG squares). Third, the algorithm throws out color and detail information to reduce the file size.

During the compression process, the algorithm compresses each JPEG square separately. Unfortunately, this causes some problems. Since each JPEG square is handled separately, JPEG squares that are next to each other may be compressed somewhat differently. Thus, two adjacent pixels that are identical or nearly identical could end up looking different because they are in different JPEG squares. This can result in the borders between the JPEG squares becoming visible and resulting in image degradation.

How visible the borders become depends on how much the image is compressed. Figures 10 through 14 show how the JPEG squares become visible as the amount of compression increases. Since the JPEG squares are very small, these images are being displayed at four times magnification so that the JPEG squares can be seen. These images are listed by the quality setting on the JPEG save menu. 100% quality means that minimal data compression was used. 10% quality means that heavy data compression was used.

Figure 10: JPEG Compression -- 100% Quality
Figure 10 shows that when minimal JPEG compression is used, the JPEG squares are barely noticeable. In much of the image, the JPEG squares are not seen. However, they can be seen along the edges of light/dark borders.
Figure 11: JPEG Compression -- 80% Quality
At 80% quality in Figure 11, the JPEG squares are just starting to become noticeable in most of the image.
Figure 12: JPEG Compression -- 60% Quality
The JPEG squares continue to become more noticeable at 60% quality in Figure 12.
Figure 13: JPEG Compression -- 30% Quality
At 30% quality, Figure 13, the JPEG squares are very noticeable in all areas of the image.
Figure 14: JPEG Compression -- 10% Quality

In Figure 14, the JPEG squares dominate the image.

Since the raw process does not compress the data, images created from raw files do not suffer from JPEG squares. This clearly results in an image quality advantage for raw.

Raw converter Advantage #7: Multiple Conversions

With raw files, the exposure can be adjusted in the raw converter (usually about two stops either way). This allows the photographer to bring out shadow and highlight detail in the final image that may not be accessible with JPEG files. The photographer can make two or more conversions at different exposures and blend them in Photoshop to bring out the shadow and highlight detail.

This technique is demonstrated in Figures 15 and 16. These two images are crops from a larger image. Figure 15 shows a wall made of boards that is in shadow. The photographer wanted a small amount of detail in these boards. The first conversion of the image set the rest of the image properly, but it left the shadows too dark and with limited detail. Figure 16 shows the same crop except that the exposure was increased in the raw converter. This brought out the shadow detail to the level desired by the photographer.

Figure 15: Crop with Normal Exposure Setting in Raw Converter
Figure 16: Crop with Additional Exposure Added in Raw Converter
While it is possible to bring out additional detail with JPEG files, there are two problems. First, if the tonal curve that was used with the JPEG file caused some of the detail to be lost, that detail is gone forever and can not be brought back by any technique. Second. The JPEG file has fewer shades in the shadows than a raw file. This may cause posterization when an attempt is made to bring out the shadow detail in a JPEG image.


Why Raw -- Part I     Why Raw -- Part III