Question

I'm doing some image processing, and I'm a bit confused by some of the terminology. Particularly, I'm confused about the meaning of "bit depth".

I have a good understanding of the structure of a bitmap: it's basically an M x N x channels matrix. So a RGB bitmap would be M x N x 3, and an RGBA (RGB with alpha-channel) would be a M x N x 4 matrix.

However, there's another variable here, which is BIT DEPTH (or color depth). According to the Wikipedia article, bit depth refers to the number of bits per pixel. So, an RGB bitmap would have a bit-depth of 24.

However, I've been playing around with libpng in C++, and libpng seems to define bit-depth as the number of bits per channel, rather than per pixel. So, an RGB bitmap can have a bit-depth of 8, meaning 1 byte (8-bits) per channel, and thus 24-bits per pixel.

Particularly, the libpng API function png_get_bit_depth returns 8 for a 24-bit RGB bitmap. So, is the Wikipedia article using the terminology wrong? Or is libpng wrong here? Or is the terminology itself somewhat ambiguous?

Was it helpful?

Solution

Neither is wrong, though specifying pixel depth is by far more common. Generally the only time you'll see component depth is on stuff intended for experts. See also x264, which has 8-bit and 10-bit versions both referring to the component depth.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top