How are RAW and HDR images mapped to 8-bit for display?
Asked 5/16/2015
3 views
2 answers
0
I’m trying to understand how a 14-bit RAW file or an HDR image gets rendered as a normal 8-bit image. If you simply scaled 14-bit RAW data linearly into 8 bits, would that just be a kind of compression without clipping? Or do RAW converters and HDR software usually apply a default tone curve instead?
In particular, does software like Lightroom ever produce a straight linear mapping from RAW to 8-bit, or is the default rendering typically some kind of tone mapping/S-curve to preserve a more natural-looking result? I’d also like to understand the relationship between bit depth and dynamic range in this context.
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
11y ago
2 Answers
2
RAW data linearly scaled down to 8-bits would result in a very flat, dull image lacking good contrast. For this reason RAW converters apply an S-curve to give much greater contrast in the mid-tones (unless you specifically ask for something else). Depending on where the end points and shoulders of the curve are placed you move the area which gets maximum contrast around (contrast is determined by the steepness of the curve at that point) whilst increasing/decreasing brightness etc.
It's important to separate dynamic range and bit depth. The two only ever depend on each other when the encoding is perfectly linear. In all other cases they are completely independent - if you choose an encoding which massively compresses the mid-tones then you can record a huge dynamic range using very few bits.
What I'm wondering is whether any programs provide a default mapping from HDR to 8-bit images one might call "compression," which would just transform each HDR pixel to an 8-bit pixel without clipping (but obviously losing dynamic detail across the spectrum).
A "high dynamic range image" in the purest sense is no different to a RAW image (aside from the Bayer pattern), they both have more dynamic range than can be displayed, just one has greater DR than the other.
When most people look at "HDR" images, they're really looking at low dynamic range images that have been generated by tonemapping the HDR data. This operation attempts to preserve some of the dynamic range by using the full range available in the LDR image to display each different area in the HDR image.
Imagine the scenario you mention earlier where you take a slice out of the data to go from HDR to LDR, now imagine that window is shifted left or right depending on where you are in the image. That's the fundamentals of tonemapping. There's a whole load of other stuff going on but that's what makes it possible to display an HDR image on a low dynamic range device (like a typical LCD monitor).
So, for example, can one ask for a "compressed" rendering of a RAW file in Lightroom? For each channel this would map 0 to 0 and 2^14 to 2^8, with other values mapped linearly in between.
You might be able to by selecting the minimum possible contrast settings, it's hard to say how much of a curve is being applied. But you certainly wouldn't want to do this in most cases as your image would look very dull.
Originally by user1375. Source · Licensed CC BY-SA 4.0
user1375
11y ago
0
Generated from our catalog & community — verify before relying on it.
A simple linear remap from 14-bit RAW to 8-bit is possible, but it usually looks very flat and dull. That’s because RAW sensor data is typically linear, while pleasing display images need more contrast in the midtones.
So in practice, RAW converters usually do not just “clip to 8 bits” or apply a plain linear scale. They normally apply a tone curve—often an S-curve—by default. This increases midtone contrast while compressing shadows/highlights into the smaller display range.
That is essentially a form of tone mapping/compression, even for ordinary RAW conversion, not just HDR workflows. The exact curve determines where contrast is emphasized and how highlight/shadow rolloff behaves.
Also, bit depth and dynamic range are not the same thing. They only track each other directly with purely linear encoding. With non-linear encoding or tone curves, a wide dynamic range can be represented more efficiently within fewer output levels.
So the short answer is: yes, software commonly provides a default mapping from RAW/HDR to 8-bit, and it is usually a non-linear tone mapping rather than a straight linear conversion.
Recommended products
UniqueBot
AI11y ago
Your Answer
Related Questions
How does a camera convert 12/14-bit RAW sensor data into 8-bit JPEG?
Why is white balance adjustment more accurate with RAW than with JPEG?
How is 12-bit RAW sensor data turned into an 8-bit JPEG or screen image?
What’s the difference between global tone mapping and a tone curve in darktable?
What does color depth in bits mean, and how does it affect a photo?