Contents > Color basics 3 / 10


Colors and computer science

Published on April 14, 2016   |  Updated on November 22, 2019


On the one hand, our eye and its complexity : it is capable of perceiving thousands of subtle colours. On the other hand, our computers, today overpowering, but only knowing the bits. How do they manage to talk about the same thing ?

It is amusing to note that the famous byte in computing (8 bits) is therefore correlated to the ability of the human eye to be able to distinguish between 300,000 and 8 million different colors (in an extreme or even theoretical case).



Colors in the digital age

How can you manage to code with 0s and 1s since a computer can only do that (but it does it very very fast and repeatedly if necessary, wow!), thousands or millions of subtle colors ?

Colors and computer science

Researchers have succeeded in digitally modelling the complexity of colors as seen by a human being. They had to start from the basic functioning of computers, i.e. 0 and 1 (called a bit) and the human eye which sees in RGB on 200 distinct shades per color for the most efficient of them and again, never in the three primary colors. To do this, they had to invent models based on these 0 and 1s to display, for example, a particular colour on a screen. These mathematical models are the bit and the byte (one byte is equal to 8 bits).


Bit and byte !

A bit represents two possibilities: 0 or 1, on or off. It is therefore written as 2 ¹. A byte consists of 8 bits, i.e. a sequence of eight 0 or 1. This represents 28 combinations: 2x2x2x2x2x2x2x2 = 256 combinations !


I will take as an example a red pixel on my monitor and admit that I only have these two numbers - 0 and 1 - at my disposal because I have a really very rudimentary computer! Either I send a 1 (a small electrical current flows to my pixel) and I turn it on, or I send a 0 (no electrical signal) and it remains off. I say my signal has 1 bit. So I have two possibilities: 0 or 1. 0 to say to the signal: off or 1 to say to the signal : on! However, I know that my monitor today is able to display this red pixel more or less clear, with subtle differences, subtle differences that my eye is eventually able to perceive. The same applies to the other two primary colours V and B. The goal, let's not forget, is to display an infinite number of colors! So I need more than one bit but then how many bits so how many numbers to code my signal do I need ?

  • With a number - 0 or 1 gives me 2 possibilities : on or off. My signal is encoded on 1 bit which is written 2 ¹.
  • With two digits - 00 or 01 or 10 or 10 or 11 gives me 4 possibilities of brightness levels: off, dark, light, very light. My signal is encoded on 2 bits - 2² - 2 x 2 = 4 possibilities.
  • With three digits - 000, 001, 010, 100, etc. gives me 8 possibilities. My signal is encoded on 3 bits - 2 ³ - 2 × 2 × 2 = 8.
  • And so on... but up to how many ?

However, after testing many human beings, other CIE researchers, around 1930, found that it took, at best, 200 shades in a gradient of a single primary color for it to be perceived as continuous, from the darkest to the lightest of that color, as in the example below. There are at least 200 shades of blue in the gradient below (top gradient). If there were less, we would have the sensation of seeing bands - otherwise called tonal breaks - in the same color gradient, here at the bottom.

Color gradients with or without breaks in tones

And these are human beings with excellent visual acuity because, according to a test conducted in 1998, most human beings see only 2 million color shades and color marketers even argue that human beings would distinctly perceive "only" 300,000 different colors because very few human beings distinguish 200 shades in each primary color. So on how many bits - how many digits - do I have to code my signal to have at least 200 combinations per primary color at my disposal to potentially cover all scenarios ? The result is 28 = 256 possible values from 0 to 255. With 7 digits - 27 - I would only have had 128 possible combinations per color. Let us note in passing that for many human beings this would have been enough ! With 8 bits I have 256 × 256 × 256 possible combinations (256 per primary color) or more than 16.7 million!!!! To do it right, the human eye would really need it: 200 × 200 × 200 = 8 million at the most and especially in theory so I even have a margin. So I have 16.7 million different RGB computer definitions to describe 8 million colors in absolute terms. Since combination 28 is unique, computer scientists have given it a special name : the byte. The byte therefore comes from the properties of the human eye !


Note about color definitions

It goes without saying that since the eye can only perceive 200 shades per primary color (and not yet in each case) at best, it will perceive the same color, that the screen displays the combinations 200, 200, 200 or 200, 200, 201 or 199, 200, 200 so at least three different RGB definitions, in this example, knowing that I could have continued a little further.

Try it out ! Take a color and modify it by only 1 point on one of the two or even three RGB components and you will see that the difference is extremely subtle... and often invisible! The eye can distinguish between 100 and 200 shades per colour. This is why we speak of color definition and not color when we describe a color by an RGB signal.


It is said that the signal is encoded in 24 bits - 3 × 8 bits - so on three bytes since one byte = 8 bits. Each signal is therefore a succession of eight 0 or 1 and this three or four times, for each RGB or CMYK color. An RGB signal will therefore be written as 255, 112, 44 for example (Red fully lit, green at 112 and blue at 44 is relatively dark).


Numbers and colors

Now that we know how to represent a color digitally, let's send a given RGB signal, always the same - 255, 112, 44 - to several different monitors, such as on the walls of home appliance stores' monitors. What's going on? What's going on? None of them have the same color ! Indeed, the RGB filters placed in front of each pixel of a monitor will be different in each monitor but even more so in different monitor models, of different brands. The RGB color model therefore does not allow the same color to be displayed directly on several different devices. As we saw in the introduction, it was therefore necessary to invent a color model independent of human eyes and their slight differences as well as of the different peripherals, i. e. absolute: the L*a*b* model. The color space L*a*b* was invented in 1976 by the CIE, always it. To a color L*a*b* corresponds only one color therefore only one wavelength. So for the same red pixel on each screen to which we have sent the same RGB signal, a slightly different L*a*b* color will correspond.  

Very important! A given digital signal - therefore a given RGB triplet, in our example - 255, 112, 44 - can therefore correspond to several different colored sensations for a person with a "normal" view if it is sent to several displays, for example. It is fundamental in color management to always have this notion in mind and therefore in what follows.

LAB to RGB colorsAn RGB signal does not "really" represent a color - even if it is based on the human eye model - but a digital data (a color definition) which, when sent to a given device, is translated into a given color (an L*a*b* color) and depends on the components that were used to manufacture it. The RGB model is therefore practical in its operation because it is based on the functioning of the eye, but it is not absolute in any way, unlike the L*a*b*.

On the other hand, if I want to display the same color on several monitors, I will have to send them a different RGB signal! If I want to display a medium neutral grey (normally 100, 100, 100) on different monitors, I will have to send them different RGB signals so rather x, y, z for one, x', y', z' for another rather than x, x, x as one might expect. Since it is almost impossible to know what value to send to a given screen to display the "right color", it is necessary to calibrate it with a calibration sensor and create, for each monitor, a small file containing this precious information: an ICC profile. The ICC profile is therefore the basis for color management.

How then can I imagine a single color perceived by a standard eye for a digital pair if, for a given screen, I have to send it an RGB signal xyz and not xxx so that it displays a neutral color? It is once again to the ICE's credit that it has answered this question. This is what we will see with color spaces and colorimetric models on the next page. But before that, I would like to make one more important point, since it is the notion of the gamma of the eye or a screen - The gamma of the eye, of a monitor - 4 / 10   Suivre


To be remembered !

 In computing, we play with 0s and 1s. The smallest unit is called the bit. A code bit for 2 possibilities : 1 = on or 0 = off.

 To encode colors, we need more than one bit : on or off because we want to display almost infinite shades of color. If a bit codes for 2 possibilities : on or off, we need more bits to code the colors. With 7 bits for example we would have 128 possibilities (2 power 7 = 27 = 2x2x2x2x2x2x2 = 128 nuance possibilities for each primary color (RGB). We therefore need to encode the colors on 8 bits in order to have more than 200 possibilities that we need. We can even say that this is too much with 256 possibilities and 8 bits.

 The "digital" colors are therefore coded on 8 bits (i.e. 255 levels whereas 200 would be enough but this represents a dead end in computing): as this value is strong and important because it allows to code the colors that human beings see, computer scientists have given it a name : the Byte.

 Since the colors are encoded on one byte on all three RGB components, it is said that the colors are encoded in 24 bits.

 An RGB pair of values does not represent a color alone but only a color definition: a color definition can therefore represent a lot of different colors depending on the color space we will see a little further on...

Through these 10 pages we will learn all the vocabulary related to color management: color spaces, ICC profiles, gamuts, etc...
- Introduction to color management
- Eye and color perception
- Colors and computer science - 3 / 10
  - Colors in the digital age
- Numbers and colors
- To be remembered...

- Gamma
- Color spaces
- ICC profiles
- Assign an ICC profile
- Convert an image
- Relative and Perceptual Conversion Modes
- What is calibration ?!


- 2020 monitors buying guide !
- My 35 full monitor reviews!


Calibrate your monitor with the best
colorimeter: X-Rite i1Display Pro !

Read my full review...


Calibrate your photo printer with the
best value for money: X-Rite i1 Studio !

Read my full review...  










From 2002, this Website offers...

This site dedicated to color management for photographers and videographers, beginners or professionals, visited by more than 300,000 people last year, offers on the one hand to help you easily understand and put into practice the color management of your photos and on the other hand helps you make the best investments with more than 100 hardware or software reviews since April 2002 in French and 2014 in English! It is the result of a patient work and a long experience shared by a professional but above all passionate photographer !


Where do the tested products come from ? Is my opinion completely independent ?

All the products I talk about on this site have been tested by me either following a personal purchase, a friendly loan, during a training session at a customer's site or after a manufacturer's loan.
They thank me for the precision of my remarks which will help their future products to progress. So things are moving and my

impartial opinion is more and more appreciated.... If I believe your emails, your trust marks and even some brands.


... And how to participate!

So my proposal when you don't know how to thank me for the free content: think about using my links to buy in these different partner shops because they play the game!




Legal informations

Legal information is available on my page Legal information








Sitemap  |   About   |   Legal information