Color by the Numbers

DP160_FINAL_j

PhotoShop uses numbers to represent colors. In the early days of modern computers their main usage was to deal with the complex simultaneous equations required for calculating artillery trajectories. It was Alan Turing (British, 1912-1954) who first proposed the thought that any idea or symbol that could be represented by a number could be programmed into a computer. This profound concept led to using numbers to represent the letters of the alphabet and made it possible to use computers to bust into the secret codes of World War II.  Each letter corresponds with a numeric value in a look-up table. The most common look-up table in use today is called ASCII, which means American Standard Code for Information Interchange.

The look-up table in PhotoShop is called a color space and there are many. Examples include AbobeRGB, sRGB, and AppleRGB. Each of these color spaces is designed to represent a portion of the spectrum of visible light. While the spectrum of visible light is not infinite the human eye can perceive more nuance of color hue and brightness than can be represented in a color space. This is because the look-up table can only define 16,777,216 colors. Any given color space seeks to create a subset of the spectrum of visible light using 16,777,216 symbols. This is called a gamut and it defines the palette of available colors.

To understand why the color space is limited to 16,777,216 colors you must understand how numbers are represented inside a computer. A computer is nothing more than a fancy light switch. It only knows two things, ON, and OFF. This is known as binary logic and because the computer can be ON or OFF very fast it can accomplish work quickly. Decimal numbers must be converted to binary where the computer can use them and then converted back to decimal for output. The computer treats the value of a number differently than the symbol for that number.

 

SYMBOLS

What do the symbols mean? The drawing above shows the original way in which decimal number symbols were made. Note that the value for each symbol is equal to the number of angles in that symbol. Arabic numerals, known formally as Hindu-Arabic numerals are the most common symbolic representation of numbers around the world. They are considered an important milestone in the development of mathematics. The true elegance of the system is that the symbol for zero has no angles.

How do we read a decimal number? Recalling our first grade math we read numbers in columns. The rightmost column is the ones, then the tens, hundreds, thousands, and so on. Decimal means ten and there are ten symbols. Table #1 below shows the values for each column and how they are calculated. These values are so drilled into us during our early education that they become innate and we rarely think about them.

TABLE #1 DECIMAL

10 ^7= 10000000 10 ^6 = 1000000 10 ^5= 100000 10 ^4= 10000 10 ^3= 1000 10 ^ 2= 100 10 ^ 1=10 10 ^ 0=1

Binary means two and there are two symbols. Table #2 below shows the values for each column and how they are calculated.

TABLE #2 BINARY

2 ^ 7=  128 2 ^ 6=    64 2 ^ 5=    32 2 ^ 4=    16 2 ^ 3=      8 2 ^ 2=      4 2 ^ 1=      2 2 ^ 0=      1

Finding the value for a row of symbols is the same in both cases. For example, using the decimal value 5284(d) and Table #1:

For the 1st  column we have 4 * 1      =    4

For the 2nd column we have 8 * 10    =        80

For the 3rd  column we have 2 * 100  =       200

For the 4th  column we have 5 * 1000=      5000

Adding them together we get                         5284(d)

Binary values are found in the same way, for example using the binary value 1101(b) and Table #2:

For the 1st  column we have 1 * 1  = 1

For the 2nd column we have 0 * 2  = 0

For the 3rd  column we have 1 * 4  = 4

For the 4th  column we have 1 * 8  = 8

Adding them together we get                         13(d)

All PhotoShop RGB color spaces are represented by 24 bits in three channels. In the 20th century industrial chemists developed the CYMK color space by using a color-model based on the primary colors cyan, magenta, and yellow (CMY). In the printing industry, because these pure pigments are expensive, the color Black (K), is substituted for equal parts of CMY to lower ink costs, thus producing a another color-model, the CMYK system which in PhotoShop have four channels rather than three.

In RGB there are eight bits each for red, green, and blue. The binary values for each color range from 00000000(b) to 11111111(b).

00000000(b) is zero and is equal to 0(d) of course but lets see what 11111111(b) is in decimal:

For the 1st  column we have 1 * 1  = 1

For the 2nd column we have 1 * 2  = 2

For the 3rd  column we have 1 * 4  = 4

For the 4th  column we have 1 * 8  = 8

For the 5st  column we have 1 * 16  = 16

For the 6nd column we have 1 * 32  = 32

For the 7rd  column we have 1 * 64  = 64

For the 8th  column we have 1 * 128  = 128

Adding them together we get                          255(d)

Because in the computer zero is a counting value there are 256 decimal values that can be represented by eight binary bits. 256 reds, 256 greens, and 256 blues.

256 * 256 * 256 =  16,777,216

In the first seconds of the Big Bang the universe was too dense for light to escape. After a few moments light emerged as a part of the electro-magnetic spectrum. SPECTRUM

The visible spectrum is defined as the portion of the electromagnetic spectrum that is visible to (can be detected by) the human eye. Electromagnetic radiation in this range of wavelengths is called visible light. There are no exact bounds to the visible spectrum; a typical human eye will respond to wavelengths in air from 400 to 720 nanometers, although some people may be able to perceive wavelengths from 380 to 780 nm. Other living things that have eyes may respond to different parts of the electro-magnetic spectrum. Even plants and inanament objects respond to different parts of the electro-magnetic spectrum. This is known as subtractive color because most of the spectrum is absorbed as heat and what we percieve as its color is only the part that is not absorbed. This explains why a black object placed in direct sunlight will become noticeably warmer than a white object in the same light. No object has pure color, everything contains mutiple color componates.

When the temprature of an object changes the color of that object also changes.This can be seen in a piece of wood which may be brown when cold and red when hot. Moisture can also cause a color change. There is only one object, known as a “black body radiator”, that does not change color and that is a star and even a star changes color over the course of its life but remains consistant relative to its temperature.

black_body

 

GOLLY MR. WIZARD! WHY IS THE SKY BLUE?

The sky is blue because 78% of our atmoshere is Nitorgen. The size of the N2 atom corresponds with the wavelenghts in the blue, cyan part of the spectrum. This scattering occurs across all wavelenghts  and is know as Rayleigh scattering (John William Strutt, British 1842-1919 aka Lord Rayliegh). On the Moon the sky is black because there is no atmoshere. On Mars it’s red due to CO2.

Color is how our eyes and brain interpret light.  Sir Isaac Newton (British, 1643-1727) listed the pure spectral colors we see in light as red, orange, yellow, green, blue, indigo, and violet. But “Roy G. Biv” isn’t the only name in town when it comes to what colors exist. In 1790, researcher Thomas Young (British 1733-1829) said the human eye sees only three colors — red, blue, and yellow — and every other color was just a combination of these primary colors. In 1878 Ewald Hering (German 1834-1918) posited a theory of four unique hues of red, green, yellow, and blue, which, when mixed with white or black, represent all the possible colors humans can process. The problem is that nobody really knows exactly how many colors the human eye can see. The closest researchers can estimate is millions and millions. Scientific experiments have shown that humans can discriminate between very subtle differences in color, and estimates of the number of colors we can see range from as low as 200 thousand to as high as 10 million. Of course, every person’s eyes perceive color a bit differently, and every culture has its own names for colors so coming up with an exact number may not be possible.

In the early days of color science it was observed when there was sunlight and high levels of moisture in the air a rainbow would appear and that ice and certain minerials such as field spar and gems would show colors when held at an angle to the sunlight. It was believed that these colors came from the material as the light passed thru them.

Aristotle maintained that the two principal “colors” were white and black – light and its absence – and that all colors derived from one of the four elements: air, water, earth and fire.

Leon Battista Alberti (1404-72), expounded in 1435  “Through the mixing of colors infinite other hues are born, but there are only four true colors from which more and more other kinds of colors may be thus created. Red is the color of fire, blue of the air, green of the water, and grey of the earth… white and black are not true colors but are alterations of other colors”.

In the 17th century Sir Frederick William Herschel did two remarkable things relating to color. Glass technology and optics had advanced and he had access to prisms. He placed a prism on his bench with a light beam to spread the colors and put a thermometer nearby to take an ambient reading. He then placed the thermometer into each of the colors and recorded the temperatures. When done and being the good scientist that he was, he moved the thermometer out of the light to take an second ambient reading. To his surprise, the temperature went up. William Herschel discovered the infa-red part of the spectrum.

The other amazing thing Herschel did was to place two prisms aligned on his bench such that the light refracting from the first was directed into the second. He expected to see a further definition of the light pattern but was again surprised to see that the light reconverged back to white.

rainbow_prism 3

This proved conclusively that the color was in the light not the object and sent physics for a spin.

Frequency is inversely proportional to wavelength. At 400 nm the frequency is 1/.000000400 and at 720 nm the frequency is 1/000000720.

1/.000000400 = 2500000 f

1/.000000720 = –1388888 f

=   1111112 f range

In 1900, Max Planck (German 1858-1947) was working on the problem of how the radiation an object emits is related to its temperature. He came up with a formula that agreed very closely with experimental data, but the formula only made sense if he assumed that the energy of a vibrating molecule was quantized–that is, it could only take on certain values. The energy would have to be proportional to the frequency of vibration, and it seemed to come in little “chunks” of the frequency multiplied by a certain constant. This constant came to be known as Planck’s constant, or h, and it has the value

Planck’s constant = 6.626068 × 10-34 m2 kg / s

 

Based on Planck’s work, Albert Einstein (German 1879-1955) proposed that light also delivers its energy in chunks; light would then consist of little particles, or quanta, called photons, each with an energy of Planck’s constant times its frequency.

1111112 / 6.626 * 10^-34  = 167689.70721400543314216722004226 * 10^-34 or

1676897072140054331421672200422600000000 possible energy levels in the  visible spectrum.

The Boltzmann (Austrian 1844-1906) constant relates energy at the individual particle level with temperature. Color temperature is measured in degrees Kelvin, William Thompson (Irish 1824-1897 aka Lord Kelvin). Direct sunlight is measured at about 5778K and “daylight” measured at about 5600K. Most digital cameras use 5500K as the reference for the daylight white balance.
This is because the “Great Yellow Father” said so and all Kodak daylight color films were balanced at 5500K. This became the reference for all film manufactures and continued into the digital realm.

It is not truly known how small a change of energy level is detectable by the human eye but it is certainly larger than the 16,777,216 possible energy levels that can be represented using 24 binary bits. Files using a bit depth of 16 or 48 binary bits can represent 16,777,216 * 16,777,216 possible energy levels and has some advantages in file editing. Because of the limited gamut (see below) of printers and monitors however a bit depth of 16 has little meaning in the ability to perceive a change in color.

This problem is dealt with by creating what is called a color space. A color space such as sRGB, Adobe98, or ProPhoto is nothing more than a data lookup table that equates binary values from 0 (recall that in a computer 0 is a counting number and has a value) to  16,777,215 to a range of the possible energy levels of the visible spectrum.

 

COLOR_SPACES_2

Monitors and printers are dependant on the phosphors and ink sets used and are only capable of reproducing a portion of the color space. This is called a gamut and is a subset of the color space. The choice of a color space should be made based on the gamut available.  When an image is converted to a different color space what colors can be displayed and printed is changed and conversions should be applied only with intent.

Because different monitors and printers are dependant on the phosphors and ink sets used another device dependant data lookup table is applied called a profile. The profile makes a conversion from the color space to the device space. The monitor is a fixed device and normally has just one profile that is updated by recalibration as it ages. Printers on the other hand may have many profiles. The media printed on has a large impact on image brightness and color and each should have its own profile.

Profiles are made using special software and measuring devices. In the case of monitors a spectrometer is attached to the screen while a series of color patches is displayed. The software knows what color it expects to see and adjusts the lookup table values so that accurate and repeatable colors are displayed. Printers are much the same. A set of color patches are printed with no profile applied and the patches then measured.

Color management is an important issue in the digital domain. In a calibrated system it is possible to predict what the resulting print will look like. If printing in house it will save time and money. If sending work out for printing it is even more important. In the days of film the print shop had the film or a print reference to color correct and match. With a digital file the print house has only what they see on their screen to judge color. If your screen and their screen are not calibrated in the same way they have no way to know that and the result may not be what you expect. Even with color management in place “proof” prints are made for review and approval before a job is run.

You have heard it said, “its not rocket science”. Well, color science is rocket science. This is due mainly to the subjective nature of color and not color management. With the tools available today color management is easy to control. Things like emotional response and simultaneous color contrast are different issue and the gist for another article.

Postscript:  While 16 bit processing has become more common the two main means of output (Prints and Web) remain 8 bit which places a constraint on the available gamut.

 

 

 

Why Color?

Doyle Thomas   Copyright protected 2012