Colour
Digital Multimedia, 2nd edition
Nigel Chapman & Jenny Chapman
Chapter 6
This presentation © 2004, MacAvon Media Productions
6 157–158
Colour & Science
• Require a model that relates subjective
sensation of colour to measurable phenomena
• Spectral Power Distribution (SPD)
• How intensity varies with wavelength
• Good model, but too cumbersome to work
with in computer graphics
• Tristimulus Theory
• Any colour can be produced by mixing
different amounts of three additive primaries
© 2004, MacAvon Media Productions
6 158–160
RGB Colour
• Use standard red, green and blue as primaries
• Actually no single agreed standard
• Cannot mix all visible colours from R, G and B
• Restricted to RGB gamut
• Basis of colour reproduction in monitors
• Represent any colour with three numbers (r,g,b)
• Use as pixel's stored value in bitmapped image
© 2004, MacAvon Media Productions
6 161
Colour Depth
• Can choose number of bits for each of r, g and b
• More bits per component means more colours
can be distinguished, but image files will be
larger
• 8 bits (1 byte) per component: 24-bit colour,
millions of colours
• If r = g = b, colour is a shade of grey, so
greyscale can be represented by a single value
• 8 bits permits 256 greys
© 2004, MacAvon Media Productions
6 163–167
Indexed Colour
• 8-bit colour only permits 256 colours
• Instead of storing (r, g, b) for each pixel, store an
index into a palette or colour lookup table (CLUT)
• Index can be small, usually a single byte
• Palette stores up to 256 (for 1-byte index) 24-bit
values
• To determine colour of a pixel, look at the stored
value, use it to look up full 24-bit (r, g, b) value in
palette
© 2004, MacAvon Media Productions
6 167–169
Colour Palettes
• Ideally choose 256 most important colours in an
image to store in its palette
• When 24-bit image is reduced to indexed colour,
some colours may be missing form the palette
• Replace missing colour by nearest, may lead to
posterization
• Dither – use pattern of dots and optical mixing
• Web-safe palette – 216 colours guaranteed to
reproduce accurately on all platforms and browsers
© 2004, MacAvon Media Productions
6 170–171
Complementary Colours
• Subtract additive primary from white gives its
complement
• Equivalently, add other two additive
primaries
C = G+B = W-R
M = R+B = W-G
Y = R+G = W-B
• Cyan, magenta and yellow are subtractive
primary colours (mixing ink/paint)
© 2004, MacAvon Media Productions
6 172–173
CMYK Colour
• Real inks do not correspond to ideal subtractive
primaries
• Combining three inks for black is undesirable
• Printers use four process colours, cyan,
magenta, yellow and black
• CMYK gamut is not the same as RGB
• Implications for using images prepared for
print (CMYK) on the Web (RGB)
© 2004, MacAvon Media Productions
6 173–176
HSV
• Alternative way of specifing colour
• Hue (roughly, dominant wavelength)
• Saturation (purity)
• Value (brightness)
• Model HSV as a cylinder: H angle, S distance
from axis, V distance along axis
• Basis of popular style of colour picker
© 2004, MacAvon Media Productions
6 176–177
YUV
• Can be useful to separate brightness and colour
information, especially for video
• Luminance Y not simply related to R, G and B
because eye is more sensitive to some colours
• Y = 0.2125R + 0.7145G + 0.0721B
• Can store Y plus two colour difference values B-Y and
R-Y
• Strictly use non-linearly scaled Y' and weighted
colour differences U and V or CB and CR
© 2004, MacAvon Media Productions
6 179–183
Channels
• Instead of considering 24-bit image as array of
3-byte pixels, consider it as 3 arrays of 1-byte
pixels
• i.e. 3 greyscale images, k/a channels, one for
each of R, G and B
• Can adjust levels &c of each channel
independently to make colour corrections
• Actually quite tricky, so Photoshop also
provides specialized colour correction tools
© 2004, MacAvon Media Productions
6 183–184
Colour Profiles
• Different monitors, scanners, &c have different
colour characteristics – different colours correspond
to same numerical value
• Vary with model, age, temperature,…
• Captured by (ICC) colour profile, which includes
values for:
• R, G and B chromaticities
• White point (may be given as colour temperature)
• Gamma
© 2004, MacAvon Media Productions
6 184–186
Colour Management
• Software maps between colour spaces of
different devices
• e.g. scanner and monitor, designers's
monitor and customer's monitor
• Use colour profiles of devices to perform the
mapping
• Store input device profile in image file
• Only works if profiles are accurate, which relies
on frequent calibration
© 2004, MacAvon Media Productions
6 187
sRGB
• 'Standard' RGB colour space
• Chromaticities, white point and gamma
supposed to be typical of monitors
• W3C standard
• Convert image colours to sRGB
• Should still display well on most monitors
without using colour management software
• Alternatively can colour manage without
storing input device profile
© 2004, MacAvon Media Productions