RAW vs JPEG

In my last post I talked about the photography workshops I've been offering here in Santa Barbara. With two of the three sessions complete, the feedback has been positive and I know I've learned a ton just by going through the process. I'm looking forward to the last session in a few days and also to thinking about how to continue helping people learn more about the basics of photography, either with more live workshops or via webinars.

One of the things we focused on in the workshop is the difference between raw files and JPEG image files, something that is a real mystery to many. I'll get deeper into the technology in a later post, but for now let's stick with the basics. First, "raw" doesn't stand for anything, it simply means raw as in "unprocessed" or "not cooked." A raw file is made up of the raw data recorded by each pixel, or photo site, on your camera's sensor. If your camera has a 12 megapixel sensor, each of the roughly 12 million distinct photo sites will record the intensity (and, in a way too complicated to get into now, the color) of the light striking it. But to view a raw file as an image, the recorded data has to be processed by a raw editor like Lightroom, Photoshop (both of which use the Adobe Camera Raw conversion software) or others. Things like brightness, white balance (the color of ambient light, which varies between bright sun, deep shade, indoor artificial light, etc.), contrast and color saturation are adjusted according to the photographer's taste for a given image. From there, the image can be saved as an image file in a number of file formats (.tif, .psd (standard Photoshop format), .jpg (JPEG) or others depending on how the image is to be used and/or shared. If saved as a .tif or .psd, the image file will be close to the same file size as the original raw file with no loss of quality. OK, I know this is complicated, but here's the real insight.

If you set your camera to record JPEG files instead of raw (and with some cameras you may not have a choice), the camera does the processing of the raw data by itself and on the fly. Based on the settings in your camera, the conversion process is managed by your camera's software, so things like brightness, white balance, contrast and color saturation are "baked in" to your image file, for better or worse. But the main thing that happens when your sensor's data is recorded as a JPEG is this: a large percentage of the information that your sensor received is discarded. That's the whole point of the JPEG  file format: it's designed to "compress" the image data to make the resulting file much smaller. A raw file from a Sony NEX-7 is big at 24-25 megabytes, while a "best quality" JPEG of a comparable scene is around 5 megabytes, just 20% of the size of the raw file. That's a lot of data thrown away before you even have a chance to look at the image much less decide what you want to do with it (more on this question later).

Note: To be technically accurate, I should mention that even raw files involve some sort of compression. The math is complicated but each camera company has its own proprietary way of creating a raw file from the light striking the sensor. That's why each manufacturer has its own file name extension(s) for their particular raw files such as .nef (Nikon), .arw (Sony) and .cr2 (Canon). But JPEG is always JPEG, a common standard. Also, some argue that the compression used in creating raw files is effectively "lossless," but no one disputes the fact that JPEG compression is very "lossy" indeed as the resulting file sizes indicate. OK, back to the action.

To demonstrate all this in the workshop, I used some sample images from my back terrace. I chose this potted palm because it presented some exposure challenges with a combination of deep shadows and bright highlights. These first two images are both raw files. The one on the left was exposed OK, but the one on the right was overexposed by about 2 stops.

These next two images are both "best quality" JPEG's from the NEX-7 with the same exposure differencial. Note that I used Lightroom to make minor adjustments in the two well-exposed images on the left so they look similar, and they do. The two overexposed images are unedited, as they came from the camera. They both look pretty bad.

Now let's take a look at the same four images but with the overexposed versions edited in Lightroom to make them look as close as possible to their well-exposed counterparts. In the case of the two raw files below, the results are surprisingly good for such an overexposed image. There is some color shift in the deck and in the brightest (blown-out) highlights in the leaves (they've turned muddy gold in the edited version on the right) as well as some contrast buildup, but overall not a bad save.

But the edited JPEG on the right below didn't fare as well. The color shift in the clay pot is pretty extreme with much of the terra cotta color having turned a sickly yellow-green, and there is strong contast gain. Also, much of the detail in the bright parts of the leaves is gone as is all the detail in deck below the pot.

To emphasize this last point, take a look at the enlargements below. The one on the left is from the Lightroom edit of the overexposed raw file, and the one on the right is from the edit of the overexposed JPEG.

See how much detail in the deck there is from the raw file, even though it doesn't look like it in the unedited original above? But in the edited JPEG on the right there is no deck detail left at all. Gone.

At this point you may be wondering, "But what's wrong with the properly-exposed JPEG? It looks pretty good and it's 20% of the size." All true, but as I mentioned near the top of this post, the answer depends on what you want to do with your image. If you want to make a framable print (bigger than, say, 8 x 10 inches), the larger raw file will look better because there is more data to work with. The actual pixel dimensions of the raw files above are 4000 x 6000, while the JPEGS are 2832 x 4240, considerably smaller. Also, if you want to have more leeway in terms of your ability to correct things like exposure, white balance, contrast or color saturation (all the things your camera's JPEG encoding software "bakes in"), or if you want to do more with creative interpretations of your images, you will have much more fun and be able to get better results if you shoot raw and do your initial image editing in Lightroom or another raw editor. Smaller files are great, but these days 64GB data cards for your camera and 1TB (1000GB) hard drives are fairly inexpensive.

And you may also be wondering, "If I need a raw editor to view a raw file, what am I looking at when I play back a raw image on the back of my camera?" Well, it's basically a thumbnail version of the JPEG your camera would have recorded if you'd set your camera to shoot JPEG's.

In future posts I plan to go deeper into:

  • The whole question of how image resolution (pixel dimensions), printer resolution and document (print) resolution determine print size and quality.

  • The difference between "destructive" and "non-destructive" editing techniques (Hint: everything you do in Lightroom is non-destructive).

  • Image file management and backup strategies. As they say, the question isn't IF your hard drive will fail, it's only a matter of WHEN.

As always, I welcome comments and questions. If you would like to read a much more thorough and technical explanation about raw vs. JPEG, take a look at this article Understanding the Difference Between Raw and JPEG from Adobe.