Bits and the Number of Colors

Bits and Binary Numbers

If you don't know anything about binary numbers you may need to read the support file "Binary Numbers". The following information may, or may not, make sense without this.

What's a Bit? Binary Numbers

The Number of Colors

All computer images are stored at a fixed number of colors, called the "bit depth". This is no more than the number of digits needed for the RGB value. For example, if you have 256 colors in your image you need each RBG value to have 3 digits. So the number 8 would be 008 and the number 10 would be 010. Likewise if you wanted 2 million colors you would have color information like 1000134 and 0000002. If you were only to use 9 colors, you could use only 1 digit of information for the color data and drop all the leading zeros. This alone would save you 90% of the file size. Your numbers would change from 0000006 to 6.

The following 2 files are identical except that one is stored as a 16 color image (of which only 3 are used) and the other is saved as a 'millions of colors' image.
 16 Color 8,958 bytes Millions of Colors 51,014 bytes

Bit Depth and the Number of Colors

The Bit Depth for an image is the size of the RBG value. Most Full color images have RGB values like (025,128,255). The red, green, and blue information each requires a number up to a value of 255. From the chart below you can see this takes an 8 bit number for each color component. So the bit depth for this image would be
8 bits Red + 8 bits Green + 8 bits Blue = 24 bits total.

```Bit	Number of	Common
Depth	Colors		Names
------------------------------------
1	1		Bitmap
2	4		Duotone
4	16		Windows display
8	256		Index Color (Color), Gray Scale (B/W)
16	65,536		High Color
24	16,777,215	True Color, RGB Color
32	4,294,967,296	True Color, with alpha channel
```
A special case is the TIFF file which can be stored as a 32 bit color file. This is not a file with 4 billion colors. Rather it is a file with 16 million colors and each pixel has a 8 bit number added to show 256 variations of transparency. This is called the Alpha channel.

Other Useful Color Information

The number of colors the human eye can see is between 2-20 Million.
The number of shades of gray the human eye can see is between 20-200.

Different methods of testing account for some of the variation, but most of the problem is the lack of hard data. After reading about 20 webPages I found that most of them simply stated a number of colors the human eye could see without a single reference or reason.