When it comes to digital photography, you always hear of shooting only raw files instead of jpegs. Why and what actually does that mean? By now, you’ve probably heard some talk about digital raw capture, but finding a coherent explanation of just what a digital raw capture actually is can be a bit more challenging. Part of the challenge is that raw isn’t one single thing.
To understand the nature of digital raw captures, firstly it is important to know a bit about how digital cameras that shoot raw actually capture images. A raw file is a record of the data captured by the sensor. While there are many different ways of encoding this raw sensor data into a raw image file (i.e. Canon’s .CRW and .CR2, Minolta’s .MRW, Olympus’ .ORF, and the various flavors of Nikon’s .NEF), in each case the file records the unprocessed sensor data. There are different technologies that can be included in the category of “digital camera,” but almost all of those that shoot raw are of the type known as “mosaic sensor” or “color filter array” (CFA) cameras.
So let’s see how these CFAs actually work. A CFA is a two-dimensional area arrays that collect the photons recorded in the image (fig. 1). The array is built up of rows and columns of photosensitive detectors—typically using either CCD (charge-coupled device) or CMOS (complementary metal oxide semiconductor) technology—to form the image. In a typical setup, each element of the array contributes one pixel to the final image (see below).
Fig. 1 An area array—each photosensor contributes one pixel to the image
The sensors simply count photons— when light hits the sensor, produces an electric current that’s directly proportional to the amount of photons striking it. In fact, the photodiod sees “light”, that is photons, without understanding the real wave length which determines, to our eyes, the real color. That is, a normalized scale is built from 0 (the darkest, that’s the black) to 1 (the brightest, that’s the white) and all of the colors in the middle are the greyscale. The key point is that raw files from color filter array cameras are grayscale.
Greyscale to colors
The role of the color filter array is to create color images from the raw grayscale capture. In order to have each photodiod seeing only one wavelenght, that's only one color, each element in the array is covered by a color filter, so that each element is dedicated to capturing only red, green, or blue light fig. 2).
Fig. 2 Photodiods covered by color filters
Many cameras apply the filters in the Bayer pattern (fig. 3). In a Bayer pattern color filter array, each photosensor is filtered so that it captures only a single color of light: red, green, or blue. Twice as many green filters are used as red or blue because our eyes are most sensitive to green light.
Fig. 3 Bayer pattern color filter array, each photosensor is filtered so that it captures only a single color of light: red, green, or blue. Twice as many green filters are used as red or blue because our eyes are most sensitive to green light
Other filter patterns exist. Some cameras use CMY rather than RGB filters because they transmit more light, while still others may add a fourth color to the mix. The common factor in all color filter array cameras is that, no matter what color filter arrangement is used, each element in the sensor captures only one color. This means that:
Raw files contain information about light and metadata as well. Metadata, which literally means “data about data,” is generated in the camera for each capture. Both raw and JPEG captures contain EXIF (Exchangeable Image Format) metadata that records shooting data such as the camera model and serial number, the shutter speed and aperture, the focal length, etc. Raw files also include some additional metadata that raw converters need in order to process the raw capture into an RGB image.
In addition to the grayscale values for each pixel, most raw formats include a “decoder ring” in metadata that conveys the arrangement of the color filters on the sensor, so it tells raw converters which color each pixel represents. The raw converter then uses this metadata to convert the grayscale raw capture into a color image by interpolating the “missing” color information for each pixel from its neighbors.
The raw capture is demosaiced and interpreted by a raw converter, using portions of the metadata embedded into the file at the time of capture, as well as algorithms in the conversion software
This process, known as demosaicing, is one of the key roles a raw converter plays, but it’s not the only one. Raw conversion involves the following steps in addition to demosaicing.
Many different filter sets are in use with digital cameras. So the raw converter has to assign the correct, specific color meanings to the “red,” “green,” and “blue” pixels, usually in a colorimetrically defined color space such as CIE XYZ, which is based directly on human color perception.
All raw converters perform all of these tasks, but they may use very different algorithms to do so, which is why the same image may look quite different when processed through different raw converters. Some converters will map the tones flatter to provide editing headroom while others will try to achieve a more film-like look by increasing the contrast of the curve.
Generally, there is no one single “correct” interpretation of a given raw format. Vendors make a relatively subjective determination of what the best “look” is, and then adjust their converter to produce that result.
How JPEG differs from raw
When you shoot JPEG, a raw converter built into the camera carries out all the tasks listed earlier to turn the raw capture into a color image, then compresses it using JPEG compression. Some cameras let you set parameters for this conversion—typically, a choice of sRGB or Adobe RGB as color space, a sharpness value, and perhaps a tone curve or contrast setting. Unless your shooting schedule is atypically leisurely, it’s difficult to adjust these parameters on an image-by-image basis, so you’re locked into the camera’s interpretation of the scene.
JPEGs offer fairly limited editing headroom—large moves to tone and color tend to exaggerate the 8-by-8-pixel blocks that form the foundation of JPEG compression—and while JPEG does a decent job of preserving luminance data, it applies heavy compression to the color data, which can lead to issues with skin tones and gentle gradations when you try to edit the JPEG.
When you shoot raw, however, you get unparalleled control over the interpretation of the image through all the aforementioned aspects of the conversion. When you shoot raw, the only on-camera settings that have an effect on the captured pixels are the ISO speed, the shutter speed, and the aperture setting. Everything else is under your control when you convert the raw file—you can reinterpret the white balance, the colorimetric rendering, the tonal response, and the detail rendition (sharpening and noise reduction) with a great deal of freedom. Within limits (which vary from one raw converter to another), you can even reinterpret the exposure compensation.
Almost all cameras that shoot raw capture at least 12 bits, or 4096 shades, of tonal information per pixel. The JPEG format, however, is limited to 8 bits per channel per pixel, so when you shoot JPEG, you’re trusting the camera’s built-in raw converter to throw away a large amount of the captured data in a way that will hopefully do the image justice. This is exacerbated by the tendency of most camera vendors to impose a fairly steep contrast curve in the raw-to-JPEG conversion in an effort to produce a JPEG that resembles a transparency. In the process, they throw away about a stop of usable dynamic range, and you have essentially no control over what gets discarded.
In some ways, it’s tempting to draw the analogy that shooting JPEG is like shooting transparency film while shooting raw is more like shooting negative film. With JPEG, as with transparency film, you need to get everything right in the camera, because there’s very little you can do to change it later. Shooting raw provides considerable latitude in determining the tonal rendition, like negatives, and also offers great freedom in interpreting the color balance and saturation. The fact that raw also lets you control detail rendition—noise reduction and sharpening—breaks the analogy but offers a further advantage.
Raw offers one more potential advantage that may be hard to demonstrate but is, I believe, real nevertheless. If you shoot raw, you’ll be able to take advantage of future improvements in raw converters. Digital photography may no longer be in its infancy, but it hasn’t yet reached adolescence, let alone maturity, and anyone who has spent more than a couple of years working with digital imaging knows that digital imaging software improves with each iteration. JPEGs are relatively inflexible files—we may see improvements in their handling, but any such improvements are likely to be modest. Raw converters, however, have undergone radical improvements in the 10 years or so that color filter array cameras have been around, and there’s little reason to think that the next 10 years won’t see similar improvements. Shooting raw will allow you to exploit these improvements as and when they happen.
All of the informatios here treated are born from my personal studies, most of them taken from Bruce Fraser's book "Real World Camera Raw", published by Peachpit Press, in August, 2004. Bruce has made a study of human vision and how it relates to reproducible color in photography.