Importance of Color Space
Everything would be simpler if all image files used the same color space. (0,0,0) would be black. (The first number is red. The second number is green, and the third number is blue. The numbers range from 0 to 255.) (255,0,0) is red, (0,255,0) is green, (0,0,255) is blue, (255,255,255) is white, and (128,128,128) is medium gray. Simple, effective, but there are at least two realities that need to be considered:
1. The trained human eye can distinguish about 200 grayshades. The range of 0 to 255 is what can be represented with 8 binary bits. By far the majority of image files use 8 bits for red, 8 bits for green, and 8 bits for blue, and are called 8-bit color files. So 255 grayshades, even if uniformly spaced insofar as human perception is concerned is just barely enough.
But, there’s a problem. What do we mean by “uniformly spaced?” From the perspective of a computer monitor, uniformly spaced could mean that the additional light produced by a, e.g., red pixel for one additional value is uniform. If we go from (0,0,0) to (1,0,0), the additional red light is the same as going from (128,0,0) to (129,0,0), or from (254,0,0) to (255,0,0). Seems reasonable. But, the human eye is not linear. So “uniformly spaced” from the monitor’s perspective isn’t uniformly spaced from a human eye perspective.
Or, consider the perspective of an ink jet printer, putting yellow, magenta, cyan, and black inks on a page. (Many printers use more than just 4 colors, but let’s not let this get more complicated than it needs to be.) More red is obtained by putting less cyan ink on the page. Cyan ink passes green and blue light, but absorbs red light. But inks are nonlinear, so uniform increments of ink don’t result in uniform changes in red light, and uniform changes in red light aren’t perceived as being uniform by the human eye.