Bit depth refers to the color information stored in an image. The higher the bit depth of an image, the more colors it can store. The simplest image, a 1 bit image, can only show two colors, black and white. That is because the 1 bit can only store one of two values, 0 (white) and 1 (black). An 8 bit image can store 256 possible colors, while a 24 bit image can display over 16 million colors. As the bit depth increases, the file size of the image also increases because more color information has to be stored for each pixel in the image.

In more technical terms, an 8-bit file works with RGB using 256 levels per channel, while 10-bit jumps up to 1,024 levels per channel. This means a 10-bit image can display up to 1.07 billion colors, while an 8-bit photo can only display 16.7 million ( 256x256x256). 8-bit video is prone to banding when you start manipulating areas that require a smooth gradient of color. A sunset is a great example because you may see moments where it jumps from one color to the next instead of making a smooth transition.

Bit Depth Conversion

To convert 5 bit color to an 8 bit color

x8 = (2^8 - 1) / (2^5 - 1) * x5
where x5 and x8 are 5 and 8 bit values respectively.

 

The color components of an 8-bit RGB image are integers in the range [0, 255]. A pixel whose color components are (255,255,255) displays as white. To convert an RGB image from double to uint8, first multiply by 255. Conversely, divide by 255 after converting a uint8 RGB image to double.

RGB8 = uint8(round(RGB64*255))
RGB64 = double(RGB8)/255

 

Similarly to convert an RGB image from double to uint16, multiply by 65535.  Conversely, divide by 65535 after converting a uint16 RGB image to double.

RGB16 = uint16(round(RGB64*65535))
RGB64 = double(RGB16)/65535