Raw or JPEG?

We’ve come a long way in the 20+ years I’ve been dealing with digital cameras. A very long way. 

Quite frankly, early JPEG rendering left a lot to be desired, even well into the early DSLR era. While some people were running around early in the century saying “JPEG is all you ever need to shoot” I didn’t believe that was true then, and voiced my concerns vehemently enough that I pissed off a few of those JPEG worshippers. 

Things might be a bit different today. 

Bit Depth
Before I get too far into the debate, let’s make sure we know what we’re dealing with here. Most digital cameras have sensors that are capable of 11-bit to 14-bit data discrimination; a few medium format cameras take that to 16 bits. What that means is that the difference between values in the low data positions—shadows—on the sensor often is meaningful. 

  • JPEG — The camera’s electronics take the original photosite data, which is a single 12-16 bit value for a single color at every position, and creates pixels that are RGB (via a process called demosaicing). In doing so, a bunch of things happen: linearity/contrast/color changes are applied, color temperature of light is fixed, the data is downsized to 8-bits, and the data itself is put through a Discrete Cosine Transform to create compression of the file size. 
  • Raw — The camera just records the photosite data in 11-bit, 12-bit, 14-bit, or 16-bit containers. Some cameras (or options on some cameras) apply a lossless or lossy compression to the data. In the higher-end Nikon cameras, we can choose these things (12 or 14-bit, lossy or lossless or no compression). In the lower end Nikon cameras, they use a dedicated 12-bit form that applies lossy compression to highlight data. In many Sony cameras, the data is reduced to 11-bits and a lossy compression scheme is used on the data. 

As I note in my books, “best case” for image data is 14-bit Uncompressed NEF for Nikon shooters. That’s as close to the original sensor data as you can get. But even 12-bit (or Sony’s 11-bit) compressed raw data is better than JPEG’s 8-bit data. Why? Because bit depth ultimately determines what you can do with the data. The fewer bits you use, the less discrimination there is between “small differences” and the more rounding errors start to compound if you start moving data around. That’s especially true at the shadow end of your processing.

The classic case of too few bits is posterization after post processing. And the classic example of that is that you try to change values in the sky—make it deeper and bluer in color, for example—and suddenly you see “bands” in the sky instead of a nice graduated change from its brightest to darkest spots. 

Artifacts
Okay, let’s go back in time for a moment before continuing on with the data discussion. Early JPEG rendering tended to be crude. Two types of JPEG artifacts were often visibly present in images from turn-of-the-century cameras: blocks and mosquitoes. Blocks show up in large detail-less areas with small changes of value across them (those skies again), which exposes the edges of the JPEG 8 x 8 pixel blocks used for compression. If adjacent blocks aren’t evaluated and compressed considering the neighbor values carefully, the compression can result in the block boundaries showing up. This artifact has all but disappeared over time as JPEG rendering engines got more sophisticated. Those block boundaries are still there, but generally we can’t see them short of doing extreme post processing moves. 

Mosquitoes occurred at the boundaries where detail was adjacent to non-detail (edge of roof at sky, for example). This was another of those not considering what’s-happening-in-neighboring-blocks problems. Mosquitoes, like blocks, have mostly disappeared over time as JPEG engines got better. That said, noise can confuse the JPEG engines and trigger mild mosquito issues. 

My Original Objection to JPEG
When I originally objected to JPEG as the primary shooting choice early in the century, it was because of the aforementioned problems: lack of bits and prevalence of artifacts, coupled with the permanent instantiation of contrast and color values. Of these, the artifact problem has really gone (mostly) away, plus we do now have more control over contrast and color decisions made by the camera. As long as we get them right before the shot. 

So today things are somewhat different than they used to be, other than that 8-bit issue. Camera makers have continually tweaked not only the rendering engines—Nikon went to 16-bit calculations internally from their original 12-bits—but have tuned their controls and added options to them for users. If you know what you’re doing, you can get a very good looking JPEG images out of virtually any current camera, and in almost any situation. 

However, if you “miss” something (wrong white balance, wrong exposure, wrong contrast selection, too much or too little sharpening or noise reduction, etc.), you only have 8-bits of data to work with in correcting that down the line. 

The Dynamic Range Problem
Which brings me to dynamic range. It seems that everyone is all gaga over wanting more dynamic range. The problem is that you have to put that dynamic range somewhere ;~). Consider, for example, that I invent a camera with 16 stops of dynamic range. And that you choose to shoot in 8-bit JPEG. How many bits of data are used to record the lowest stop of dynamic range? (I’ll make it easier on you and let you consider the range to be distributed linearly over the bits.) Short answer: not enough. 

The more dynamic range we get in our sensors, the more important it is to make sure that it gets recorded exactly how you want it to if you’re going to shoot in JPEG. You’ll be fighting the tyranny of “too few bits” if you want to start moving shadow values around after the fact, for example. There’s an easy test for this if you’re using Lightroom and shooting JPEGs: how often are you moving the Shadows slider? Never? Great, keep shooting JPEGs just like you are. A lot? You’ll be better off shooting raw. Moving the shadows slider too much with 8-bit data leads to blotchy shadow areas. 

I’m Not Anti-JPEG
Because of my early statements about JPEG, people think I’m anti-JPEG. These days, I’m not. 

For most people in most uses, JPEG is plenty good enough, as long as you pay attention to your settings and don’t push data where it shouldn’t be (at the two extremes). This very well may mean that you have to turn on a feature like Active D-Lighting in many situations in order that the highlights don’t blow while the shadows don’t get too deep in the bottom bits. The Nikon cameras are dealing with 16-bit data when they make Active D-Lighting adjustments, so the “bit problem” generally isn’t an issue in generating the final pixels. But if you try to do the same thing as Active D-Lighting after the fact, guess what, bits are an issue.

You’re a JPEG Shooter, Always
But here’s some news: you’re always shooting a JPEG. 

Yes always. On Nikon cameras, a JPEG BASIC LARGE image is embedded in every raw file. Every Tiff file, too. It’s used as the image you see on the camera’s LCD, the image from which histograms and highlights displays are made, and the preview or thumbnail image you see on your computer most of the time. 

Don’t believe me (or want to get that JPEG out)? Download the free Instant JPEG from RAW tool that my friend Michael Tapes created. 

That, by the way, is the reason why I don’t generally shoot NEF+JPEG on my Nikon cameras any more. I can always get a perfectly usable JPEG right from my NEF file whenever I need it. Yes, it’s another workflow step, and yes JPEG BASIC isn’t quite as good as JPEG FINE. Still, the advances made on JPEGs over the years make the 36mp extracted JPEG from my D810 work just fine for any purpose I can think of. 

Just one thing, though: since you’re always shooting a JPEG image, you should always be setting the White Balance and Picture Controls to proper values on Nikon DSLRs. (You have to be careful about using Active D-Lighting, though, as it changes exposure, even for raw data.) What’s “proper”? Values that produce good looking JPEG images ;~).

Size and Convenience
So we’re getting near an answer to the question in the title of this article. There’s two last things to discuss: size and convenience. 

JPEGs are compressed. Highly compressed, actually. First book I pulled off my shelf was the D700 one, so we’ll use the data in it as an example:

  • JPEG — 5.7MB on average, largest size
  • NEF — 25.5MB on average, largest size (14-bit, no compression)

So a 5x difference in file size, though this can be managed downward by giving up bits or using compression. Even then, though, the raw file size will typically be a minimum of 2x that of a JPEG. 

One common complaint I hear, even from relatively sophisticated photographers, is that "file sizes are too big and I’ll have to buy more/bigger drives.” You’re just going to have a difficult time using that argument on me. I started with paper tape, where a giant pile of it might have only 8K of data on it. Storage gets less expensive over time and continues to push forward. As I wrote this, B&H had a very good Western Digital portable 2TB drive on sale for US$79. 

Frankly, storage of images has always been a problem, even with film. If you’re going to keep shooting, you’re going to need more storage over time, period. And yes, that’s a bit of a hassle to keep moving forward (originally larger file cabinets with film, now larger drives with digital). But if you stop swimming in the storage pool, you’ll eventually drown. 

Sure, my D810 NEF files are averaging about 43MB each. I can fit 23 in a gigabyte. And 46,000 of them on that US$79 drive I just mentioned. If you’re shooting 46,000 images and they’re not worth US$158 to preserve (original plus backup), I’m scratching my head trying to figure out why. So I’m not buying the “raw files are too big” problem.

Convenience has changed a lot, too. It used to be a real hassle to shoot a week’s worth of images and then have to convert them. Many products that claimed to be able to “batch process” raw images were a pain in the butt when you tried to actually do that. I can’t tell you how many times Nikon Capture crashed when I tried that in the early days of digital. 

Today, however, we have some excellent alternatives that make it easy to make changes to lots of images quickly. Missed the white balance setting? Correct it on one image in Lightroom and apply to all the rest of the raw images shot that way. It’s a lot more convenient to work with raw files today than it ever was. Products like DxO Optics Pro try to automatically “fix” everything that we used to sit for hours and do by hand, such as linear distortion and chromatic aberration. 

Sure, having a JPEG right on that storage card in the camera is convenient. Even Nikon’s WMU and SnapBridge apps (iOS and Android) can grab it if your camera has WiFi (or Bluetooth in the case of SnapBridge), and then allow you to send it wherever you want (more on that in a moment).

So, JPEG or Raw?
The answer is still raw if you’re trying to get the most out of your images that you can. JPEG is still a convenience format, despite how good the actual results have gotten from most cameras. 

It’s really the 8-bit size that stops me from shooting JPEG. Because of the way bits are distributed, we have a lot of discretion for moving highlight data after the fact with JPEGs, very little for moving shadow detail without producing rounding errors or posterization effects. Large post processing moves (color, exposure) with JPEG files often trigger visible issues, simple as that. 

JPEG has always been about throwing away a lot of data in order to give you a small and convenient file to work with. So if your shooting is all about convenience (not the typical reader of this site), great, shoot JPEG. 

But as I noted, you’re always shooting a JPEG. You can always extract one. Better yet, you can always create one in the camera from the raw file. 

Remember that Nikon WMU utility app I mentioned? Let’s say you’re shooting NEF and you’ve got a smartphone plus Wi-Fi in your Nikon DSLR. What do you do? Simple, go to the RETOUCH menu and select NEF (RAW) processing. Pick your image and process it. I’d tend to pick BASIC SMALL, by the way. Why? Well, the WMU utility is going to make your JPEGs 1620x1080 when it transfers them to your phone/tablet’s camera roll anyway. You don’t need a big JPEG for transfer to mobile device, and you’ll get image quality benefits from downsizing during the raw processing. 

Likewise, SnapBridge will do something similar, though Nikon has mucked things up a bit (why if the camera can make a JPEG from a raw file can’t the camera automatically do it if you select the file for SnapBridge transfer?). 

So that’s my answer today. Shoot raw. Extract or make JPEG  in camera if you need it. Check back in another decade and I’m sure I’ll have a different answer.

text and images © 2017 Thom Hogan
portions Copyright 1999-2016 Thom Hogan-- All Rights Reserved
Follow us on Twitter: @bythom, hashtags #bythom, #dslrbodies