Color Images

How Color Pixels Work

You've already learned how images can be represented using black and white pixels. Each pixel is just one bit: 0 for white and 1 for black.

But how do we add color? The answer is to use more bits per pixel. Instead of 1 bit, we use multiple bits to represent a mix of Red, Green, and Blue light.

Red
+
Green
+
Blue
=
Any Color!

With 3 bits per pixel (1 bit for each color), each pixel can be one of 8 different colors. With more bits per channel, we get more shades and more control!

The image file stores three pieces of before the pixel data: the image width, height, and , each stored as 1 . Then all the pixel data follows.

Watch: RGB LEDs on a real TV