RAW Mode for Digital Cameras

Tom Davis
Tom's home page

Last Modified: January 16, 2006.

Note: There's a great book on raw mode and how to use it in Adobe Photoshop. It's called "Camera Raw with Abobe Photoshop CS2", by Bruce Fraser. It is vastly more informative and complete than this web page.

I think that the easiest way to understand RAW mode is first to think about what happens when you take a photo with a digital camera. I'll use my D100 as the example.

Everything is exactly the same as in a film camera as the light comes in though the lens, is metered, focused, et cetera, until the instant it gets to the film, and the film's not there! In its place is a grid of electronic sensors that come in three types: one sensitive to red, one to green and the third to blue light. If you have a "six megapixel camera", that means there are about six million such tiny sensors on the electrical pickup which is called a "Charge-Coupled Device", or CCD.

Each red sensor, in a sense, "counts" the number of red light particles (photons) that arrive, and the more that arrive, the higher the voltage is built up on that sensor. Thus in parts of the scene where there's a lot of red light, the red sensors will have relatively high voltages, et cetera.

Now in reality, these are all tiny, tiny voltages since each pixel is a tiny part (one six-millionth) of the CCD.

After the exposure, the camera reads all six million voltages, each to an accuracy of one part in 4096 (in other words, there are 4096 different possible values of "red" from 0 (completely black) to 4095 (the brightest red that the CCD can detect)).

As I said above, the voltages are tiny, so an amplifier is used to amplify the tiny CCD voltages to something the camera electronics can deal with. You can vary the strength of the amplification to make the CCD work in dimmer light, but the more amplification you use, the more noise will be in the signal. The ISO setting you use translates directly to the amplification, so low ISO numbers give less noise (less amplification) and high ISO numbers give more noise and amplification.

These six million numbers between 0 and 4095 for each of the sensors on the CCD constitute the RAW data, and if you're taking photos in RAW mode, effectively that's exactly what is saved on your memory card -- the voltages after the ISO-controlled amplifier is through with them.

Data in this form is, of course, useless for programs like Photoshop which need a red, green, and blue value for each pixel. Also, the red, green and blue values require some interpretation, based on the white-balance settings of the camera. For example, if you tell the camera you're shooting with a flash, it knows the color temperature of the light from the flash and with that knowledge, it can figure out what a "red = 2311" really means in terms of true spectral red. This interpretation is different for different color temperatures of light from sun, cloudy, fluorescent, et cetera, situations.

After this translation based on the current white-balance is done, the exposure can be shifted up or down a bit (maybe not three stops but at least 1 or 1.5 in both directions without too much error). Then the individual red, green and blue values from individual sensors are packed in a fairly complex way to make triplets of (red,green,blue) that correspond to the pixels you deal with in Photoshop or similar programs.

There are a bunch of other calculations that are done that diddle the sharpening, hue, et cetera, and these correspond various settings you can set on your camera.

At this point, you've got RGB values for every pixel, and if you save this as a 16-bit TIFF file, that's what you've got.

If you save as JPEG, it does even more: it throws away 15/16 of the color resolution and does a "lossy" compression to save lots of space.

The beauty of RAW mode is that the only thing that's saved is the data that comes out of the CCD after amplification. It does record the settings on your camera for sharpness, hue adjustment, tone curves, exposure compensation, et cetera, but it does not apply ANY of them. When you read a RAW file into Photoshop (or similar program) and just take the defaults, those which were set on the camera at the time the shutter was tripped are what will be used.

But -- you can also change any of them and read in the data under new assumptions! So if the shot was underexposed, you can read it in with a +1 exposure compensation. Or if your white balance was set to "cloudy+2" and you forgot and took a photo with a flash so your colors are screwed up, you just re-read the RAW file with the "flash" white-balance. You get the idea.

If you're working with a TIFF or JPEG file, you can't go back to the raw data -- the camera "commits" to all the settings at the instant your image is written to the memory card. With RAW images, the only thing you're really committed to is the ISO setting.

So -- the disadvantages of RAW mode are that the files are bigger (about 9.6 megs per shot on the D100, although with the gigabyte CF cards at only about $100 now, that's not such a big deal anymore), and you need special software to interpret the RAW data. Nikon has some software that works: "Nikon Editor", but the best way is with a Photoshop plug-in. In Photoshop CS, there's a built-in plugin that works great for the D100 -- the image comes up, you diddle all the things you want and get a rough preview in the preview window, then say "OK", and it does the RAW interpretation according to whatever settings you set or changed. Then you just edit it as before, but save it as a TIFF or JPEG or Photoshop file. Or whatever else you want -- just not RAW. But the RAW file remains as it was so you can always go all the way back to that, if you wish.

Rant mode on!

Note: As of late 2005, this rant no longer applies; Nikon and Adobe have somehow made up, but you have to use the latest version of Photoshop CS2 with the latest raw plug-in to get it. But there were a lot of complaints to Nikon, so at least this is a case where they listened to the customer. But I'm leaving in the rant to show what a painful situation it was.

With the Nikon D2x (and I believe also with their D2h2), Nikon encoded the white balance in their RAW files. It's not a strong encoding, but since it's encoded, companies like Adobe who break the code and read the white balance data could be sued by Nikon, if they haven't come to an agreement.

That means that the Adobe plug-ins for Photoshop can't find out what your original white balance settings were and so the software has to guess. The idea, I guess, is to make everyone pay for the Nikon software at around $150 a pop.

And the Nikon software is (on a pretty quick Mac, at least) as slow as molasses in January. It's also much less powerful than Photoshop, so if you really wanted to do optimal editing, you'd have to get both programs, do the conversion from RAW to something usable in the Nikon program and then import that into Photoshop to do your other work.

You could, I suppose, just shoot the Nikon at known color temperatures and record them yourself, but that means you can't use the auto white balance setting which is sometimes pretty convenient.

What a pain in the butt!

Those Bastards!

Rant mode off Thanks for your patience.

The best analogy I can think of is that the RAW file is like the film in your camera just after you take the photo, but before you take it to the developer. From that stage, there are a bunch of things that happen before you have a print, and at every stage there are options. You can push or pull develop, or cross develop, depending on what you want, and you've got a negative. Then you can print the negative using all sorts of filters, dodging, burning, et cetera, on different papers, et cetera. Of course once you develop the film, you can't go back and re-develop it.

In the same way, if you save as JPEG, it's like you're saving the print. There's no way to go back, even to the negative, and especially to the film before it was developed. Of course you can scan the print and work with that, but now you're a long way from the original data.

So RAW files are like the film in your camera after you take the shot, but before you even develop it. It's like you can re-develop and re-print as many times as you want using different options to obtain the best results.

The biggest thing is the fact that in RAW form, there are 12 bits of data per color per pixel, instead of the 8 you have in jpeg. That means there is 16 times as much color resolution, so if you do something like a histogram expansion, you can do it without putting "holes" in the histogram in almost every case.

Photoshop CS lets you do a lot (but not all) operations on 16-bit data; Photoshop 7 and before have very limited 16-bit capabilities. I think PS 7 lets you do a histogram expansion, but then you had to convert to 8 bits before you could do much of anything else. If you're going to do RAW digital work and you don't have Photoshop CS, I'd get the upgrade. I do not know what RAW-mode capabilities the non-professional versions of Photoshop have, nor the capabilities of other competing software.


Return to my beginner's guide to photography.
Return to my page on digital photography

Want to send me mail? Click: ( tomrdavis@earthlink.net)