Thursday, December 1, 2005

Bit depth in JPEG images

LETTER TO THE EDITOR

By David Gewirtz

A few weeks ago, we responded to a question from Andrew Daviel in Canada...

What is the bit depth (analog converter resolution) of a camera, and what happens to this bit depth when an image is converted to JPEG (or not) and then viewed on a computer monitor or printed?
I notice that when manipulating an image to brighten it, that bright areas start to saturate and the colours get corrupted, due to only having 256 brightness levels. I read somwhere that some cameras have a 12 or 14-bit A/D converter, but as far as I can see JPEG allows only 8-bit (or maybe 12-bit) depth. No idea what my camera has as native depth -- cheaper Kodak which converts to JPEG internally -- but I think I only see 8 bits in the output files.

Our short answer was:

Typical JPEG images provide 24 bits per pixel, but that's 8-bits per channel (red, green, and blue). If you use a more modern version of Photoshop, you'll notice it will also let you work in 16-bits per channel, which gives you 48 bits per pixel.
Most likely, though, you'll need to save the image as a RAW image (which will be far bigger than your JPEG) and then work with that at the 16 bits per pixel bit depth.

Reader John Byers wrote in with a much more comprehensive answer. Needless to say, we're trying to get John to write for Connected Photographer on a regular basis. What follows is John's commentary...

John Byers on bit depth

A more complete answer to the question:

The ability of a camera to capture high bit-depth images requires an image sensor with suitably high dynamic range (at least 4,000:1 for 12 bits per channel), and a correspondingly high A/D converter bit rate and a file image format that supports it. The weakest link in this chain of requirements determines the actual bit-depth of the captured image.

The physically small image sensors used in compact digital cameras provide a dynamic range of around 256:1. These cameras typically use 8-bit A/D converters, allowing up to 256 brightness levels for each RGB color channel. The images are stored as 24-bit JPEG images -- 8 bits per color channel.

The physically larger sensors used in digital SLR cameras have higher dynamic range capability than those used in compact cameras, and are able to capture more subtle tonal graduations. DSLRs are usually equipped with 10- or 12-bit A/D converters, providing distinction for 1,024 or 4,096 brightness levels per channel, respectively. Normally DSLRs offer the option to save the 10 or 12 bits of data per pixel as a RAW file, because JPEG only allows 8 bits of data per channel.

The A/D converter bit rate is normally designed to match the image sensor dynamic range capability. If the image sensor has only a 256:1 (8-bit) dynamic range, a 10- or 12-bit A/D converter may produce a smoother tonal range, but it can only provide 256 brightness levels per channel. Similarly, if image data is captured at 12 bits per channel, storing it as 16-bit TIFF will not create new brightness levels. Storing a 10- or 12-bit image as JPEG or 8-bit TIFF will cause the distinction between some brightness levels to be lost.

Thanks, John!