Images & Bitmaps

💻 Computer Science Years 8–11 Foundation

How bitmap images store pixels, and how resolution and colour depth determine file size.

Open this lesson, with practice and a printable worksheet →

Zoom far enough into any photo on your phone and it dissolves into a grid of tiny coloured squares. Each square is a pixel, and its colour is stored as a binary number. A picture, to a computer, is nothing more than a long list of numbers — one per pixel — describing a grid. This kind of image is called a bitmap.

Why this matters: Understanding pixels, resolution and colour depth lets you predict a file's size, explain why a photo looks blurry when enlarged, and make sensible trade-offs between quality and storage — decisions every photographer, gamer and web designer makes daily.
1 pixel
A bitmap is a grid of pixels; each pixel holds one colour value.

Resolution

4 × 4 (blocky)8 × 8 (smoother)
More pixels (higher resolution) = finer detail, less blockiness.

Resolution is the number of pixels across by the number down, e.g. 1920 × 1080. More pixels means finer detail but a bigger file. Enlarge a low-resolution image and the individual squares grow visible — this blocky look is called pixellation. Think of pixels like tiles in a mosaic: more, smaller tiles give a smoother picture.

Colour depth

1 bit → 22 bits → 43 bits → 8n bits → 2ⁿ colourseach extra bit doubles the palette
Each extra bit doubles the colours: n bits = 2ⁿ.

Colour depth is how many bits are used to store the colour of each pixel. With n bits per pixel you can label 2n different colours. So 1 bit gives 2 colours (black & white), and the "true colour" used by photos is 24 bits = over 16 million shades.

Bits per pixelNumber of colours (2n)
12
24
8256
2416 777 216

Working out file size

Every pixel needs the same number of bits, so the raw size is simply:

file size (bits) = width × height × colour depth

Divide by 8 to get bytes, and by a further 1024 for kilobytes.

Worked example — an 8 × 8 icon with a colour depth of 3 bits.
width × height = 8 × 8 = 64 pixels× colour depth 3 = 192 bits÷ 8 = 24 bytesbits → bytes: always divide by 8
Size = width × height × depth (bits), then ÷ 8 for bytes.
Pixels = 8 × 8 = 64. Bits = 64 × 3 = 192 bits. Bytes = 192 ÷ 8 = 24 bytes.
A larger example: 200 × 150 pixels at 24-bit colour = 30 000 pixels × 24 = 720 000 bits ÷ 8 = 90 000 bytes (about 87.9 KB).
Common mistake: forgetting to divide by 8. The formula width × height × depth gives the answer in bits. If a question asks for bytes and you don't divide by 8, your answer will be eight times too big. Always check the unit the question wants.

Bitmaps are one of two big image families. The other, vector graphics, stores shapes as instructions (a circle of a given radius and colour) rather than pixels, so it can be scaled to any size without pixellation. Photographs are always bitmaps, because a real scene has too much fine detail to describe as neat shapes.

Tip: file size grows with both resolution and colour depth. Doubling the width and height quadruples the pixel count; the two levers together explain why high-quality photos are so large. (Real formats also add a small header, but exam calculations usually ignore it.)

Get the printable worksheet →
← Characters (ASCII & Unicode) → Sound
← Sasta Basta home All subjects