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.
Resolution
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
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 pixel | Number of colours (2n) |
|---|---|
| 1 | 2 |
| 2 | 4 |
| 8 | 256 |
| 24 | 16 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.
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).
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.)