Zoom far enough into any digital photo and it breaks up into tiny squares of colour called pixels. Each pixel's colour is stored as a binary number, so the number of pixels and the bits per pixel decide how sharp the image looks and how big the file is.
An image is a series of pixels (picture elements), and the colour of each pixel is converted to binary so the computer can process it. The resolution is the number of pixels in the image (width × height). The colour depth is the number of bits used to represent each colour; n bits give 2n possible colours. As resolution and colour depth increase, the quality and the file size both increase.
Fig. 1: a tiny black and white image stored row by row as 1s and 0s
Section 01
Pixels in binary.
In the lab, paint a few pixels and read off the binary stored for each row. Then raise the colour depth and see each pixel need more bits.
Colour depth
Colours possible
Typical use
1 bit
2
black and white
4 bits
16
simple icons
8 bits
256
simple graphics
24 bits
16 777 216
photographs (8 bits each for red, green and blue)
Your turn
How many colours can be shown with a colour depth of 6 bits?
26 = 64 colours
Examiner trap
Colour depth is a number of bits, not a number of colours. "A colour depth of 256" is wrong; say 8 bits, which gives 256 colours.
Section 02
Resolution and quality.
Lower the resolution in the lab and the image becomes blocky (pixelated); lower the colour depth and the colours become banded. Both make the file smaller.
Higher resolution: more pixels, so finer detail can be shown; but there are more pixels to store, so the file is larger.
Higher colour depth: more possible colours, so colours look more realistic; but every pixel needs more bits, so the file is larger.
Lower either: a smaller file that loads and sends faster, but a lower quality image.
Examiner trap
Resolution is the number of pixels in the image, such as 800 × 600. It is not the size of the picture in centimetres.
Stage 1 · Learn
Check what the sim just showed you
Four quick checks. Each correct answer earns XP and records this skill on your profile.
Quick check+10 XP
What is the resolution of an image?
Quick check+10 XP
What is the colour depth of an image?
Quick check+10 XP
How many colours can a colour depth of 8 bits represent?
Quick check+10 XP
In the lab, the colour depth is raised from 1 bit to 8 bits with the same resolution. What happens to the file size?
Section 03
Image file size.
Every pixel needs (colour depth) bits, so multiply the number of pixels by the colour depth.
File size in bits = width in pixels × height in pixels × colour depth.
Then convert: ÷ 8 for bytes, ÷ 1024 for KiB, ÷ 1024 again for MiB.
Worked example Size of a photo
An image is 800 pixels wide and 600 pixels high with a colour depth of 24 bits. Calculate its file size in KiB.
Pixels = 800 × 600 = 480 000.
Bits = 480 000 × 24 = 11 520 000 bits.
Bytes = 11 520 000 ÷ 8 = 1 440 000 bytes.
KiB = 1 440 000 ÷ 1024 = 1406.25 KiB.
Answer: 1406.25 KiB
Your turn
An image is 100 × 50 pixels with a colour depth of 4 bits. What is its size in bytes?
100 × 50 × 4 = 20 000 bits; ÷ 8 = 2500 bytes
Stage 2 · Exam
Exam-style questions
Unlocks once the four checks above are done. Worth more XP, written to IGCSE Paper 1 standard.
Finish the four checks above to unlock the exam questions
Exam style+20 XP
An image uses only 2 colours. What is the smallest colour depth it can use?
Exam style+20 XP
An image is 100 × 100 pixels with a colour depth of 8 bits. What is its file size?
Exam style+20 XP
What is the effect of reducing the resolution of an image?
Exam style+20 XP
An image needs to show 50 different colours. What is the smallest colour depth that can do this?
Skill unlocked
Representing images, mastered.
This skill is now recorded on your profile. Keep the chain going.