News and Views from Dave Wilson

Musings on Dynamic Range, Bits and Stops

by on Dec.28, 2009, under Computer, Photography

I got into a conversation with Guy Tal, Jim Goldstein and Pete Carr on Twitter this afternoon and it quickly became clear that it wasn’t going to work in 140 character chunks so I reckoned a blog post would be in order. This is something I’ve been meaning to write about for a while now so I’m happy I now have an excuse.

The issue under discussion related to the relationship between the number of bits used to store a High Dynamic Range image and the light levels that the image can store. An HDR image is typically thought of as being represented with 32 bits per color component (32 bits of red, 32 bits of green and 32 bits of blue for every pixel). Some of the most common HDR file formats actually use less than 32 bits per pixel but, regardless, the question comes up about what each of those bits represents and how the number of bits dictates whether an image is “High Dynamic Range” or not.

I had always assumed that the dynamic range of an image depended to some extent on the absolute maximum light level that could be recorded. On reading Christian Bloch’s rather good “HDRI Handbook” last year, I was surprised, however, to read that the dynamic range is defined instead in terms of the ratio of the number of discrete values (2**32, for example if we’re talking about a 32 bit number) a measurement can represent divided by the smallest measurable difference (the change in the signal represented by 1 least significant bit). Nowhere in this calculation does any absolute value appear – the dynamic range is a ratio of the largest and smallest values that can be represented but it says nothing about the actual quantities that those values represent.

This didn’t seem intuitive to me. Where was the reference? How would you know how bright a given pixel would be? Thinking about this for a while, however, it became clear that I was forgetting to take into account the camera as a whole rather than merely the sensor.

The camera’s sensor has a fixed, maximum signal that it can record and a certain number of bits of resolution. For example, a 12-bit sensor can differentiate between 2**12 (or 4096) different levels of red, green and blue light. At some absolute level of light, the sensor saturates and outputs its maximum value. If you increase the light level falling on the sensor above this amount either by keeping the sensor exposed to the light for longer or by increasing the brightness of the light falling on the sensor, you get no new information and the signal stays saturated.

Thinking about this from a photography point of view, however, this is exactly as you would expect and corresponds to overexposure. In this case, we close the aperture, reducing the brightness falling on the sensor, or speed up the shutter to reduce the total amount of time the sensor is exposed to the light. These changes reduce the total amount of light falling on the sensor and allow us to take another, hopefully correctly exposed image. Although the maximum light level the sensor sees has dropped and it no longer saturates, it still records 4096 different levels falling on it. The recorded dynamic range is the same but we’ve shifted the recorded values so that all of the actual image brightness levels fall within the recording capabilities of the sensor.

This is exactly as you would expect in a film camera too – if the film is overexposed, it “saturates” to opaque and you can’t store any more information (there is the complication of logarithmic vs. linear response here but let’s gloss over that for now since it’s not really relevant to this discussion). In these cases, you reduce your exposure to get the amount of light hitting the film such that you don’t saturate the medium.

Considering things this way, it is now clear (to me at least) that the absolute value of light represented by the sensor’s (or film’s) maximum output value is irrelevant. The photographer adjusts the exposure to ensure that the brightest highlight in the image is at or just below the sensor’s saturation point and, hey presto, you end up taking maximum advantage of the sensor’s dynamic range. The absolute maximum light level that will cause the sensor to saturate is, therefore, related to the sensitivity and not the dynamic range. If the sensor saturates with very little light hitting it, we end up with a high sensitivity (or high ISO) sensor that allows us to record images in lower light than one which saturates at higher light levels.

So how does this tie back in to the normal photographic system of defining exposure in terms of stops or EVs? For every bit you add to a sensor, the number of values it can represent doubles and, as a result, its theoretical dynamic range will also double (forgetting about noise which reduces this somewhat). Thinking about exposure calculations, you know that increasing your exposure by a stop also doubles the amount of light hitting the sensor. There is, therefore, a direct correlation between 1 stop and 1 bit. Reducing your exposure by a stop divides the sensor output in two or shifts the value one bit to the right. Adding a stop to your exposure does the opposite, doubling the sensor output or shifting the value one place to the left.

Using the bit shifting idea, we can, therefore, get some idea of how much dynamic range an HDR image may have based upon how we recorded it. I typically use 3 images bracketed 2 stops apart when shooting HDRs. If the original scene contains very bright highlights or lots of dark shadow areas, I will use more brackets but 3 is usually enough. My Nikon D90 has a 12 bit sensor and, at low ISO values, has close to .12 bits or 4096 levels of dynamic range. Adding +2 stops to the exposure has the effect of multiplying the sensor output values by 2**2 or 4 or shifting them 2 bits to the left. Taking away 2 stops has the opposite effect, dividing the output values by 4 or shifting them 2 bits to the right. When I combine all three exposures, -2 stops, 0 stops, +2 stops, into an HDR image, therefore, the maximum dynamic range I could possibly record would be 12 + 2 + 2 bits or 16 bits of information. Even though I may save this image in a 32 bit file format, I’m not actually storing pixel values that extend from the lowest to the highest possible value in the file format. Regardless of the fact that I’m not using the full dynamic range of the recording system (the 32 bit pixel component representation), I still have 16 bits of information per colour component which is twice the number of bits I would have had if I had saved in JPEG and 4 bits (or 16 times) more than I would have got from a single RAW file from the camera. The dynamic range of my image is something like 65536:1 versus 256:1 for JPEG or 4096:1 for my 12 bit RAW format.

Confused? If so, leave a comment and I’ll try to clarify this a bit!

:, , , ,

7 Comments for this entry

  • jimgoldstein

    A good explanation Dave, but photographers need to realize that HDR does not necessarily represent the tonal range of what we actually see. The marketing hype of HDR makes it out that it is. HDR can only display tonal range as good as the medium it’s being shown on. On computer monitors that is going to be limited by the image files color space. As we know sRGB is hardly the most complete color space yet that is what we see most often online. In many ways HDR’s promise of “equaling” what the human eye can see is a mirage. What HDR does offer is the ability to show more tonal range in a viewing environment that is by definition limited itself, just not as limited as the sensor capturing the image.

    Guy’s tweeted point alluded to the process of how our brains piece together the tonal range of what we see and how we register it. I agree the parallel is there, but that doesn’t mean the end product captures the same dynamic range. If you can represent the world outside of a shoe box with a particular technique, but still show it in a slightly larger shoe box what do you really gain?

  • Dave Wilson


    I agree, with one caveat – you are talking about the output of a tone mapping on an HDR image which is, by definition, no longer an HDR image but an image derived from an HDR source. An HDR image saved in an appropriate file format does have the capability of storing a far wider range of brightness than even our eyes can accomodate but one of the points I want to get across here is that it is unlikely that the image stored in that format will have a dynamic range anything like as high as the theoretical maximum allowed by the file format.

    The maximum dynamic range you are going to get in your (true) HDR file is limited by the camera sensor and the bracketing used to capture the constituent elements of the image.

    Once you tone map this, as you note, all bets are off and you are back in the 8bit, low dynamic range world again.

  • dougp

    I have dug into my computer and located a matlab digest article on HDR, discussing some of the math involved in both creating an HDR image and the subsequent issue of tone mapping. The article can be located at (sorry about the long URL, I haven’t gotten any truncation application installed yet)

  • Dave Wilson

    Over on Facebook, Bernard Ortiz pointed me at another discussion of this general topic. It’s a lot more technical and accurate and may be of interest. You can find it here.

  • jimgoldstein

    Dave so what is the point of having a file that has the range you want, but lack the output medium to display it? Sounds like the photographic equivalent to speakers that go to 11 🙂

  • Dave Wilson

    Isn’t that called “safety margin”? 🙂

  • Dave Wilson

    Seriously, though, the point of using a wide bit format is that it allows you a lot more scope for numeric manipulation of the data without loss of quality before you map back to the output medium’s bit depth. This is covered well in the book that I mention in the post.

1 Trackback or Pingback for this entry

  • The blog’s on fire this week | News and Views from Dave Wilson

    […] by Dave Wilson on Jan.13, 2010, under Miscellaneous, Photography I just took a look at the blog traffic stats and was stunned to see that I’m receiving a huge number of visitors just now! Traffic in the last 24 hours was 20 times my daily average and 4 times higher than the previous daily maximum (which occured a week or so ago when Trey Ratcliff kindly posted a tweet pointing HDR enthusiasts at this post). […]

Leave a Reply

CommentLuv badge

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!