Photography — shooting in RAW vs JPEG formats

One of the questions that comes up regularly on some photography forums is whether to shoot in raw format or jpeg format, and why. The usual advice is to shoot in raw, but it may not always be very clear why, especially for people who may be relatively new to this.

So, I took a few test shots and made some comparisons with different levels of processing in the hope that this will help illustrate some of the differences, and help you decide which format you prefer with more confidence.

I’ve scaled all the images to 2048 pixels on the long side; this was originally for uploading to Facebook; I think it should work here too. You’ll probably have to right-click and “view image” to see the full resolution version.

One thing you’ll notice is that if everything’s going well, JPEG is actually not bad at all—and that’s true! Sometimes discussions on the formats may leave you with the impression that JPEGs are terrible and you should never use them, and that’s not true at all. They can look very good! However, they are more finicky about exposure and balance, and don’t tolerate manipulation as much.

To start with, what IS a raw image vs. a JPEG image? These are file formats, at as basic level. The “raw” image is pretty much the actual data the camera sensor recorded, with only basic processing. (It still needs to be processed a little bit in order to be something that makes sense visually.) It contains all the image data the camera sensor could record; as a result, these tend to be pretty large files. JPEG, on the other hand, is a compressed file format designed to present images with good quality and also with smaller file sizes. This is always a compromise, since in order to compress an image beyond a certain point you have to start throwing information away, and sooner or later that’s going to start to show. The JPEG format generally does a pretty good job of this though—it was developed by people with image quality in mind (JPEG stands for the Joint Photographic Experts Group, the group that developed the format).

All these photos were taken with a Pentax K-1 full frame DSLR.

To compare the two, I started with this quick test image:

raw-1

I compared the out-of-camera JPEG image with the raw image for a variety of shots under different exposures and different processing; in the case of the raw file, all processing was done on the raw version. It was converted to JPEG for posting online as the last step. processing was done in Photoshop, and limited to exposure compensation and cropping.

Even though the exposure here is pretty good, and the JPEG looks quite good overall, you can still see some differences if you look carefully. Here’s a 100% crop of both the raw and JPEG versions of this image:

rawjpeg-100-compare-1

The JPEG is a little more saturated, and you can see that it loses a little detail, especially in the red. Overall though, it’s really not too bad. If all your photographs are well exposed and don’t need much manipulation, the JPEGs will probably work well most of the time.

Of course, that doesn’t always happen. Let’s look at one that’s fairly seriously underexposed:

unde4st-1

I used Photoshop to boost the exposure by 4.5 stops for each of these:

comp-under4

You can see that the raw version looks much more natural. The JPEG is over-saturated, lacking in detail, and there are clear color artifacts especially in the cardboard box. It’s also noisier, which is easier to see when you zoom in. It’s not terrible, yet. Here’s a 100% crop of these:

comp-under4-100

Let’s look at a more extreme example, just to make the differences more dramatic. This one is underexposed by about 8 stops (!!).

unde8st-1

At this point, I found that in order to get a similar look, I had to boost the exposure more for the JPEG version than for the raw version. Both are starting to look pretty bad, but the differences are also getting dramatic (if you didn’t think they were dramatic already).

comp-under8

At this point the JPEG is pretty much unusable. The raw version is far from great, but it’s clearly the much better off of the two.

100% crop of these, where the noise is getting pretty severe, and color artifacts are starting to shop up everywhere too:

comp-under8-100

Can we go ever further? Sure!

unde11st-1

This one looks pretty much black. I had to boost it a great deal to get anything visible.

comp-under11

It’s interesting that the jpg version is now going to monochrome! I didn’t do that; for all of these, boosting the exposure is the only adjustment I’ve done. So what’s up with that?

I don’t know for sure this is true, but I’m pretty sure it’s an artifact of the way the jpg compression works. JPEGs are compressed in order to take up less space, and in order to do that you have to throw some information away. It tries to throw away information that you can’t see anyway, and as a general rule it does a pretty good job.

But notice that in very low light, we don’t perceive color very well. Think about how things look in moonlight; reds become grey, yellow becomes white… the colors are still there, of course, and if you take a long exposure picture you’ll see them (so it’s not the color of the light either). It’s just that we don’t see the colors very well in low light.

The JPG algorithm knows this, and so it knows that it’s probably safe to throw away color information in areas of the picture that are very dark, on the assumption that we aren’t going to see it anyway. Well, for this picture, the whole frame is very dark! So, it probably assumes it’s safe to discard color information almost everywhere. The JPEG version of this image is less than half the size of the JPEG of the well exposed ones, which also seems like evidence that the algorithm feels free to throw away a lot more data here.

100% crop of the image above. The noise level is really high here too. Both of these are probably completely unusable, unless it’s the only image you could get of the loch ness monster or something.

comp-under11-100

Let’s look at what happens on the overexposed side. You’ll see that you don’t have nearly as much latitude; this one was overexposed by only about 2 stops:

over2-1

And here it is corrected. Note that there is no detail in the blown out areas; you can bring them back from white to grey, but you can’t re-create detail that was clipped off by the over-exposure.

over2-corr-1

For a more extreme example, this is over exposed by around 4 stops:

over4-1

A lot of detail is gone in this one. Many pixels in the bright areas just exposed as white (255, in 8-bit values) and all white pixels are identical to all other white pixels, so the details are gone for good. You can lower the exposure, but you just get detail-free grey.

grey