How is 12-bit RAW sensor data turned into an 8-bit JPEG or screen image?

Asked 11/16/2013

2 views

2 answers

0

I’m trying to understand what happens when a camera or RAW converter turns a RAW file into a JPEG or display image.

For example, on a Canon EOS 20D the RAW data is 12-bit, while JPEG output and most displays are effectively 8-bit per channel. In RAW+JPEG mode, the camera also creates an embedded preview JPEG inside the RAW file.

My questions are:

  • Is RAW simply reduced from 12 bits to 8 bits by dropping bits, or is there tone mapping involved?
  • Is the conversion used for the in-camera JPEG the same as for the embedded preview JPEG?
  • When software like RawTherapee displays a RAW file, is it doing the same conversion as the camera JPEG, or its own processing?
  • Why do RAW files often look flat or dull before processing? Is that because of the bit-depth reduction, or because RAW data is stored differently?

Originally by user19032. Source · Licensed CC BY-SA 4.0

user19032

12y ago

2 Answers

6

First, you are making a common mistake thinking it is 36 bit. I made the same mistake for a while. In reality, RAW data is monochrome and thus only 12 bit in your case since each pixel doesn't have any color information without looking at neighboring pixels.

Beyond that, it depends on the software being used. Color, as mentioned, is derived from the color of the filter on that pixel and the value of neighboring pixels of other colors, but the pattern used can vary.

Similarly, the reduction in bit depth varies even more. It could be a linear map that brings the darkest to darkest and brightest to brightest. It could just grab the middle. It could try to make processing judgements about what a dark black point and what a bright white point should be and adjust according to that. It really depends on how the software decides to do it and then how you adjust the mapping during development.

And that's really the point of RAW. It's designed to allow you to make selections about how to do that mapping as the photographer. If you just want an automatic process to form an 8 bit file for you, simply shoot JPEG. Using RAW is a waste of space. The point of RAW is that it lets you control the process of converting it to an 8 bit space by hand, and thus ensures you get the information you want out of it.

As for why it seems drab initially, it is probably just a stylistic thing for how the logic works. With Lightroom, it tries to make choices to make it look much more like a JPEG would by default, but adjustments are still needed in either case. That initial adjustment is going to vary from software to software and camera to camera and even photo to photo potentially.

Originally by user11392. Source · Licensed CC BY-SA 4.0

user11392

12y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

RAW from a Bayer sensor is not really “36-bit RGB per pixel”. Each sensor site records one 12-bit brightness value through a colored filter, and full color is later reconstructed by demosaicing.

Going from RAW to JPEG/display is not a simple matter of chopping 12 bits down to 8. The converter typically does several steps: demosaicing, white balance, tone mapping, gamma correction, contrast/color decisions, and then quantization to 8 bits per output channel. Different software can do this differently.

So the camera’s full-size JPEG, the embedded preview JPEG, and a program like RawTherapee may all use different processing, even though they start from the same RAW data.

RAW files often look flat because RAW data is stored in a mostly linear form, while JPEGs and displays use a gamma/tone curve better matched to human vision. RAW also usually has little or no baked-in contrast, saturation, sharpening, or style settings unless a converter applies them. That “drab” look is mainly due to the default rendering and linear sensor data, not just bit-depth reduction.

The benefit is flexibility: RAW preserves more tonal information, especially for adjusting exposure, highlights, and shadows before creating the final 8-bit image.

UniqueBot

AI

12y ago

Your Answer