Notes

Bit Depth

Bit depth describes how finely an image can record brightness or color at each pixel. Think of it as the number of marks available on a ruler: more marks let the image represent smoother changes in light, shadow, and color.

What the numbers mean

A pixel stores numerical values. With 8-bit depth, one channel can hold 28 = 256 levels, numbered 0 through 255. In an 8-bit grayscale image, 0 is black and 255 is white. In a common RGB image, each of the red, green, and blue channels has 8 bits, producing 256 × 256 × 256, or about 16.7 million, possible colors. This is also called 24-bit color because it uses 8 bits across three channels.

More bits preserve more subtle detail

Higher bit depths provide more intensity levels per channel:

  • 8-bit: standard photos, screenshots, and many web images.
  • 10- or 12-bit: high-quality video and camera raw workflows, with smoother gradients.
  • 16-bit: scientific and medical images, such as X-rays or microscopy scans, where faint differences can carry important information.

This extra precision helps avoid banding: visible stripes in what should be a smooth sky, shadow, or shaded surface. Bit depth is not the same as image resolution. Resolution controls how many pixels an image has; bit depth controls the precision of each pixel’s stored value. File format and compression also affect final file size.

Why vision systems care

Computer-vision pipelines must read and scale pixel values correctly. A model trained on 8-bit images expects values in a very different numeric range from a 16-bit medical scan. Treating a 16-bit image as 8-bit can crush subtle contrast and hide a tumor boundary, surface defect, or faint printed character. In OpenCV, cv2.IMREAD_UNCHANGED preserves an image’s original depth, while the resulting array’s dtype reveals whether pixels are stored as uint8, uint16, or another type. Correct bit-depth handling protects the visual evidence a model needs to make reliable decisions.

Bit depth is the number of binary bits used to represent each pixel value or each color channel in an image. It determines the number of available intensity levels—for example, 8-bit data provides 256 levels per channel, while 16-bit data provides 65,536. Higher bit depth preserves finer brightness and color variation, reducing quantization artifacts and supporting reliable preprocessing, measurement, and model input quality.

Think of bit depth as the size of an artist’s paint box. A small paint box might offer only a few shades of blue, while a large one can show tiny differences between pale sky blue, deep ocean blue, and everything in between.

In a digital image, bit depth describes how many brightness or colour choices each pixel can have. Higher bit depth means smoother gradients, richer colours, and more detail in very dark or very bright areas. Low bit depth can make a sunset look “striped” instead of smoothly blended.

For computer vision, bit depth matters because an AI can only learn from visual detail that the image actually contains.