4
\$\begingroup\$

When shooting with RAW files, it is possible to tune the exposure and white balance using software, which is not possible when shooting with JPEG.

But I have a stupid question: when you are shooting with not enough light, how can you add the light back with just the software alone?

\$\endgroup\$
2
  • \$\begingroup\$ What software do you use? Because there are software which allow tuning exposure and white balance of jpegs. \$\endgroup\$
    – Zenit
    Commented Jan 24, 2016 at 22:03
  • \$\begingroup\$ To put it simply: a sensor pixel counts photons. The RAW file stores these counts for each pixel. When you tune the exposure with say, Lightroom, it just multiplies these counts by a factor. If a pixel collected 100 photons, you can multiply that by 2 to "make it look like" 200. \$\endgroup\$
    – Szabolcs
    Commented Jan 25, 2016 at 9:42

3 Answers 3

9
\$\begingroup\$

You are not actually adding light, you are simply enhancing what little light you gathered. With a JPEG, "stretching" or "pushing" and "attenuating" are all done in the camera, and those enhancements are baked into the JPEG file, which is then lossy compressed and stored in a low precision format (8-bpc, 0-255).

With a RAW image, you are storing the original sensor data as it came off the sensor, without any enhancement, with lossLESS compression, in a higher precision format (14-bit, 0-16383). A RAW image is stored in a linear form, however camera settings are stored in the header as "metadata", such that when you load the image in DPP or Lightroom or any other RAW editor, it will look similar to a JPEG made with the same settings. However the actual pixel data in the RAW file is not actually modified by these settings, it is only "rendered to screen" with them, so you can see the image as it was intended.

Because the underlying data is not modified, and because it is stored in a higher precision, you have more freedom to shift the exposure around with software. You can push the shadows, pull the highlights, and adjust exposure, white balance, enhance the color, fix vignetting and a whole range of other image aspects without losing much in the way of definition or fidelity in the final result.

It should be noted that pushing shadows in an image that was underexposed is not the same as properly exposing that image. A pushed underexposed image will have more noise, because the signal strength was weaker. To have less noise, you need to expose more, so you gather more light, which improves signal strength. A strong signal has a higher SNR, and thus appears less noisy.

It should also be noted that if you are working with a scene that has high dynamic range, you may have some parts of your scene dark, possibly appearing overly dark on screen, whereas in real life those regions did not look as dark, as noisy, nor as devoid of detail. This is where camera dynamic range plays a role. A camera with 10-11 stops of DR will have more limited ability to have "shadow" detail pushed to restore realism, whereas a camera with 13-14 stops will have an extended ability to have "shadow" detail pushed to restore realism. The difference between such cameras (say a Canon 5D III and a Nikon D810) is the read noise and dark current. The Nikon camera has less of both, significantly less read noise (at low ISO), thus allowing shadow detail to be pushed more with less noise.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Note that unfortunately, some touted "raw" formats aren't actually lossless relative to the full-size raw data read from the sensor. See sRAW. \$\endgroup\$
    – user
    Commented Jan 24, 2016 at 21:30
  • \$\begingroup\$ I am aware that not all 'RAW' formats are lossless. Sony's cRAW is actually the best example of a LOSSY compressed "RAW" format. Thankfully they offer uncompressed RAW now, and will supposedly be offering lossless compressed RAW in the future. I don't consider cRAW nor sRAW to actually be RAW however, and since neither are actually required anymore, I am only addressing true RAW formats. \$\endgroup\$
    – jrista
    Commented Jan 25, 2016 at 4:20
7
\$\begingroup\$

There is nothing special or magical in RAW files.

When it comes to exposure and balance, RAW files just store more information about colors, than JPEG files do.

Either way, these colors consist of Red, Green, and Blue values and by manipulating these values you can always adjust white balance or exposure, regardless of the file type... in the ideal world. In the real world, the color manipulation will sometimes lead to posterization or clipping if the source color precision was not good enough or the intended change was too extreme.

when you are shooting with not enough light, how you can add the light back with just the software alone?

In digital images, light is just numbers, you can always increase numbers by adding or multiplying, unless there is not enough difference between numbers and even increasing these numbers won't yield different values for "dark" and "bright". More precision (like in RAW files) means more information about differences, means more room for "adding light".

\$\endgroup\$
4
  • 1
    \$\begingroup\$ I feel like there's a slight mismatch between the question you're answering and the question that the OP is asking, but I can't put my finger on what it is exactly. \$\endgroup\$
    – user541686
    Commented Jan 25, 2016 at 1:52
  • \$\begingroup\$ @Mehrdad yeah, i was only addressing the first part about RAW, it should be better now? \$\endgroup\$
    – szulat
    Commented Jan 25, 2016 at 2:24
  • \$\begingroup\$ Well it's better, but it's not what I meant. It seems to me that you're repeating to the OP something he already knows, and that his underlying question seems to have been "how could the software possibly achieve the goal it is claiming? (i.e., what am I missing?)" which to me is a slightly different question from "what is the software doing?" \$\endgroup\$
    – user541686
    Commented Jan 25, 2016 at 3:02
  • 1
    \$\begingroup\$ A minor nit - there are cameras with more than RGB, e.g. this Sony docs.sony.com/release//specs/DSCF828revision_mksp.pdf . Just means you have to map four colors off the RAW into RGB or HSV space. \$\endgroup\$ Commented May 11, 2016 at 11:47
4
\$\begingroup\$

Most definitely not a stupid question: I actually wondered the same thing when I first got into shooting raw.

Before you can really understand what's happening when you adjust exposure in software, you first need to know what a digital camera's sensor and electronics do when you take a photo: count photons. Each pixel of the sensor essentially records the number of photons that strike it during exposure, and the raw file generated contains that data without modification (plus some metadata, of course).

Next, let's think about how this applies to a photo that's been underexposed by 1 f-stop. By definition, 1 f-stop of underexposure means that the shutter was open half as long as it needed to be, that the aperture allowed only half the light through, or the ISO was set to half the sensitivity needed (doesn't matter which), and all of these translate to one thing: the sensor only caught half the light needed for proper exposure. Assuming the scene lighting isn't changing significantly from moment to moment, this also means that the photon counts read by the entire sensor are about half of what they need to be. Likewise, each subsequent f-stop of exposure above or below the intended exposure represents a doubling or halving of the photon counts.

To "add the light back", software uses this idea to estimate the correct number of photons counted for each pixel. This is done by multiplying each pixel by an appropriate correction factor, which is easily calculated. The new photon count for a pixel is given by new photon count = old photon count * 2^N, where N is the number of f-stops of adjustment (positive or negative). Unfortunately, though, the approach isn't always as wonderful as it sounds since any image noise in the photo is also scaled up by the same amount!

It's worth mentioning that this can be done with JPEGs, too, but it won't work as expected for a couple of reasons. First, as jrista said, there's more detail in a raw file, and it's much more likely that there is data "hidden" in the shadows and even in the overexposed portions of an image, but when converted to JPEG, this extra data is essentially discarded and is unrecoverable.

Also, a base curve has been already been applied to a JPEG. This base curve is what takes the linear data from the sensor and makes it into something that looks more presentable to our eyes. To adjust the exposure correctly would involve slightly more complex calculations and assumes the software knows the base curve, which it likely doesn't. The pixel values can still be scaled the same way without adjusting for the base curve, but highlights and shadows will likely change much differently than if the same technique was applied to a raw file. This is one of the many reasons why the unmodified, raw image data is so handy to keep!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.