My camera shows a histogram in the preview:

enter image description here

And after I take the photo:

enter image description here

  1. I shoot RAW, but as I understand it, the histogram is computed from JPEG, so it might indicate that the highlights and/or shadows are clipped, even if they actually aren't in the RAW. Am I correct? If so, the histogram doesn't serve its purpose for me, which is to tell me if the photo I took fails to fully capture the dynamic range in the scene, in which I case need to take another photo.

  2. Does the above point hold for the preview histogram, or the histogram I see after the photo was taken, or both?

  3. What's the relationship between the R, G and B colors on the histogram with the white histogram? Would I be correct in assuming that if there's no clipping on the white histogram, then there's no clipping on any of the histograms for the individual color channels, either?

This is on the Sony NEX-5R, if it matters.


2 Answers 2

  1. You are correct, it is computed from the JPEG and that makes it harder to tell if you've clipped the shadows/highlights. It doesn't make it less useful though.
  2. Most likely both histograms are calculated from a "gamma corrected" image and they will not be able to tell you if you've clipped for sure.
  3. The R, G and B channels on your histogram represent the gamma corrected tonal range of the different colours and the white histogram shows the gamma corrected of the entire tonal range of the image. Also all three channels must clip to blow out the "white histogram" so you can't assume that there has been no clipping in any on the three colour channels just because the "white histogram" hasn't clipped.

The common way to calculate histograms among camera manufacturers is from the JPEG file. This means that you can't use the histogram straight off to tell for sure if the shadows and highlights are clipped. If you only use the histogram to determine if you've clipped you're using them wrong and they are in fact very useful indeed when they are generated from JPEGs.

Why is the histogram calculated from the JPEG file?

In fact there is a very strong reason to the histograms being calculated from the JPEG though and that has to do with how our eyes responds to light. Chemical film mimics the eye's response but the digital sensor does not since it's lenear and what's called a "gamma correction" has to be applied to get an image that is usable. The RAW file is essentially a raw dump of the data and the gamma correction has not yet been applied to it. The JPEG however has been gamma corrected which makes it more film like and using it's histogram makes a lot more sense. If you're exposing the image based on th RAW histogram you will not use the cameras dynamic range correctly and this translates to a noisier image than it has to be.

You can't use the histogram as the sole determinant for your setting to get a good exposure. The histogram is a tool and it's properties has been tunes to show useful information regarding ho humans perceive images. You have to use it accordingly. By practising you will get a feel for when the shadows/higlights are blown and how to avoid it.

Adobe has two goodpapers related to why the histograms are calculated from the JPEG ("Raw Capture, Linear Gamma, and Exposure") and about RAW capture in general ("Understanding Digital Raw Capture") that I higly recommend you to read to get a better understanding of how to use the histogram of the camera. Also check out this question on photo.SE.

  • \$\begingroup\$ Thanks. I've already read the linked questions, and I will read the two Adobe papers. In the mean time: why don't cameras convert the RAW to a 16-bit bitmap image, and then compute a histogram based on that? Then the histogram will accurately represent clipped highlights and shadows, as in Lightroom. \$\endgroup\$ Commented Aug 24, 2014 at 4:49
  • \$\begingroup\$ @KartickVaddadi Read my answer more closely. I did explain why cameras uses gamma corrected versions of the histograms and that they are not good alone to detect clipping. In Lightroom you can't see if the RAW file is clipped by reading the histogram as it's in the prophotoRGB space with a sRGB tone curve applied. \$\endgroup\$
    – Hugo
    Commented Aug 24, 2014 at 8:34
  • \$\begingroup\$ @KartickVaddadi Also the RAW file already is a bitmap image (often derived from the bitmap format tiff), albeit compressed, and can have bit depths of 12, 14 and 16 bits depending on model/settings. \$\endgroup\$
    – Hugo
    Commented Aug 24, 2014 at 8:35
  • \$\begingroup\$ Thanks, Hugo. What I meant to say is: Why can't the camera do gamma correction and demosaicing and whatever else it does to 'develop' the RAW, but not reduce it down to 8 bits per channel. Instead, it should keep the same bit depth, whether that's 12, 14 or 16 bits per channel. Think of exporting a RAW as a 16-bits-per-channel TIFF. Then compute the histogram using this image, for it to be more useful. \$\endgroup\$ Commented Aug 25, 2014 at 2:40
  • 1
    \$\begingroup\$ The bit depth and gamma correction are irrelevant, there's absolutely nothing stopping the camera from looking at the RAW numbers that come out of the ADC and telling the user how close to saturation they are. \$\endgroup\$
    – Matt Grum
    Commented Aug 26, 2014 at 8:03

1. There's no way to get a proper RAW histogram in any digital camera that I know of, they all use the JPEG preview.

There are white balance hacks (to ensure unity scaling of each colour channel) and picture style settings (turn contrast and saturation all the way down) that make the histogram look a little more like a RAW histogram would.

2. Both histograms will be computed from the JPEG conversion.

3. The individual R,G,B histograms are computed from the colour channels of the JPEG image, that is clear. It is unclear whether the white histogram is simply the sum of the three individual histograms (in which case if any colour shows clipping the white will show clipping), or whether it is based on a luminance measure, in which case the opposite might be true. It's a moot point really as the individual colour histograms are highly inaccurate (because they are not based on RAW data) therefor however they are combined the result will be inaccurate.

In summary there is no reliable way to find out whether the dynamic range of the scene fits within the range the camera can capture. I would advise you take two bracketed shots anyway (one for the shadows and the other exposed to ensure highlights are captured).

Memory cards are cheap and that way you can download the images, look at the RAW histogram and if the DR does fit within one image you can just ignore the other one, and if it doesn't then you have two exposures to blend.

But if you really want to get the perfect exposure the advice I always give is to bracket your shots. Memory cards are cheap these days.

  • \$\begingroup\$ Thanks, Matt, I would like to bracket shots only when one shot doesn't cover the dynamic range of the scene (if there's clipping). Which brings us back to the original question of determining when that's happening, which you seem to say doesn't have a good answer. LR doesn't help here because by the time I return to my home or hotel and import the photos into LR, it's too late to go back and get another shot. \$\endgroup\$ Commented Aug 26, 2014 at 13:56

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.