Text, Sound and Images · Cambridge syllabus 1.2 · Lesson 3 of 3
Image Representation
A bitmap divides an image into pixels. Resolution gives its dimensions or pixel count; colour depth gives the bits used for each pixel. A depth of n bits can encode 2ⁿ different values. Uncompressed size is width × height × bits per pixel.
By the end, you can
- Understand that a digital image is represented using pixels.
- Understand the relationship between image resolution and the number of pixels.
- Understand how colour depth determines the number of colours available.
- Calculate the number of colours represented by a given colour depth.
- Calculate uncompressed image file size.
- Use width, height and colour depth in calculations.
- Convert between bits, bytes, KiB and MiB, using 1024 between units.
- Explain the effect of increasing resolution and colour depth on file size.
Pixels and colour
A bitmap image is a grid of pixels, and each pixel stores one colour as a binary number. Enlarge the image far enough and the individual squares become visible, which is what pixellation is.
Colour depth is the number of bits used for each pixel, and it decides how many different colours are available: n bits give 2ⁿ colours. One bit gives 2 colours, 8 bits give 256, and 24 bits — 8 each for red, green and blue — give about 16.7 million, which is what "true colour" means.
Image resolution is the number of pixels, usually given as width × height. More pixels mean more detail, and a larger file.
The two are independent. A large image with a low colour depth can look banded; a small image with a high colour depth looks accurate but shows little detail.
Worth remembering
- A bitmap is a grid of pixels; each stores a colour as binary.
- Colour depth of n bits gives 2ⁿ colours.
- Resolution is the number of pixels; colour depth is bits per pixel.
Image file size
File size = width × height × colour depth, giving the answer in bits.
An image 1024 by 768 at 24-bit colour has 24 ÷ 8 = 3 bytes per pixel, so it is 1024 × 768 × 3 bytes. Dividing by 1024 for KiB simply removes the 1024, leaving 768 × 3 = 2304 KiB, and 2304 ÷ 1024 = 2.25 MiB.
Set the working out in steps: pixels first, then bits, then divide by 8 for bytes, then by 1024 for KiB and by 1024 again for MiB. Calculators are not allowed, so look for numbers that cancel, as the 1024 did here. Most lost marks are conversion errors rather than the multiplication.
Doubling both the width and the height multiplies the file size by four, because the pixel count is what doubles twice. Doubling the colour depth doubles it.
Real image files are usually smaller than this calculation suggests, because they are compressed — but the question asks for the uncompressed size unless it says otherwise.
- file size = width × height × colour depth
- In bits. Divide by 8 for bytes.Width and height in pixels, colour depth in bits per pixel.
Worth remembering
- Doubling both dimensions multiplies the size by four.
- Convert in steps: bits, then bytes (÷ 8), then KiB and MiB (÷ 1024 each).
Worked example
A 100 × 80 image at 8 bits/pixel needs 64000 bits = 8000 bytes, ignoring headers.
Practice
Warm-up · not marked
Check your understanding
Answer in your own words, then compare with the worked answer. Nothing here is saved or scored.
Worked answer
2⁴ = 16 colours. Size = 32 × 32 × 4 ÷ 8 = 512 bytes.
Check your method, units and explanation against it.
Marked practice
Set 1 of 4 · easiest first · Checked as you go, with the worked answer. Sign in or create a free account to save your progress.