Crossing the boundary - analogue universe, digital worlds
Crossing the boundary - analogue universe, digital worlds

This free course is available to start right now. Review the full course description and key learning outcomes and create an account and enrol if you want a free statement of participation.

Free course

Crossing the boundary - analogue universe, digital worlds

4.7 Colour

Now what about the issue of colour? You should know enough to answer the question without prompting. So far, we've allocated a suitable number of bits to each pixel to give us the range of shade we need. Clearly, then, we must do the same thing to represent colour. But, how many bits will we need to devote to each pixel to represent a useful range of possible colours?

That all depends, of course. It depends on the answers to two questions.

  1. How is it possible to map a particular colour to a number?

  2. How many colours do we want?

Colour is a perfect example of an analogue property. The spectrum of light – what we get when we split white light up with a prism – is shown in Figure 20.

Figure 20
Figure 20 Continuous spectrum of light

SAQ 13

How does Figure 20 demonstrate that colour is an analogue property?

Answer

One colour merges smoothly into the next. There are no sudden transitions from, say, green to blue, or blue to violet. This is a perfect example of smooth analogue change.

So, as with all analogue things, there is an infinite number of colours to choose from. But we are trying to map colour to a finite number, so we simply haven't the option of an infinite number. What options do we have? That depends on the answer to the first question above: how to represent a colour with a number.

There are several schemes available. One of the simplest and most popular stems from an understanding of how human vision works. Certain receptor cells in our retinas, known as cones, respond to different wavelengths of light, roughly to the wavelengths of red, green and blue. All the colours we sense are a mixture of these three colours. Now all we need to do is allocate three numbers, one to each colour, representing the amount of red, or green, or blue that is mixed in that particular colour. Let's use the range 0–255 (eight bits, one byte) for each of these three numbers. So, to take some simple examples, the group

255, 0, 0

represents the colour red, as we have the maximum amount of red in our mixture, with no green and no blue. Along the same lines, the set

0, 255, 0

stands for green, since the mixture contains no red, no blue and the maximum amount of green. If you remember any of your school science, then, you will know that

255, 255, 255

is white, because white is a mixture of all three colours. All the other colours we see are mixtures of these three basic, or primary, colours.

128, 10, 128

for example, is a striking deep purple. For obvious reasons, this way of representing colour is called the RGB (red, green, blue) model.

SAQ 14

What colour would 0, 0, 0 represent in the RGB scheme?

Answer

An easy one. It's black, which is what we see when there's no light at all.

Now we can come back to the question of how many colours to choose. With this model, there are 256×256×256 possible colours, reflecting every possible mixture of our three basic shades. That's 16,777,216 colours in all. Of course, we can opt for fewer if we wish, by allocating a smaller number of bits to each of the R, G and B values. But nowadays, in an age of very cheap memory, it is common to opt for the full 16 million colour range.

Other colour models

RGB is not the only colour model. Graphic designers concerned with printed media, for example, favour a model known as CMYK. This is because the primary colours that are reflected off paper are not red, green and blue – but cyan (blue-green), magenta and yellow. The K stands for a special black ink used to add crispness. However, we will not discuss colour models any further in this course.

Before moving on, I want to introduce one problem which will become of increasing importance. Think about the question posed in the following exercise.

Exercise 11

The image of the Vermeer painting in Figure 10 contains 647×735 pixels, with the full 16 million colour palette. Work out how many bits are required to store this image as a bitmap inside the computer. How many bytes?

Discussion

The image has 647×735=475,545 pixels. Each pixel will require 24 bits – that is, 3 bytes. So the image will require 11,413,080 bits, or 1,426,635 bytes which is nearly 1.5MB.

Although modern personal computers can easily handle these sorts of memory requirements, such demands can be tricky to deal with. For a start, if I try to exchange an image of this size over a network, it is likely to be quite a lengthy and expensive process. When dealing with images, sometimes large amounts of memory are required. That is a problem we will have to keep an eye on, and find answers to. Is there perhaps a more efficient way of storing visual information?

M150_1

Take your learning further

Making the decision to study can be a big step, which is why you'll want a trusted University. The Open University has 50 years’ experience delivering flexible learning and 170,000 students are studying with us right now. Take a look at all Open University courses.

If you are new to university level study, find out more about the types of qualifications we offer, including our entry level Access courses and Certificates.

Not ready for University study then browse over 900 free courses on OpenLearn and sign up to our newsletter to hear about new free courses as they are released.

Every year, thousands of students decide to study with The Open University. With over 120 qualifications, we’ve got the right course for you.

Request an Open University prospectus