CIE AS & A Level Computer Science, section 1.2 (Multimedia)
How a bitmap works
A bitmap image is a grid of tiny squares called pixels. Each pixel is stored as a binary number that gives its colour.
Key terms
- Pixel: the smallest element of the image.
- Image resolution: the number of pixels in the image, such as (width height).
- Screen resolution: the number of pixels the display can show.
- Colour depth (bit depth): the number of bits per pixel. A depth of bits gives possible colours.
- File header: data at the start of the file that describes the image, such as its width, height and colour depth, so the software can rebuild it.
| Colour depth | Number of colours |
|---|---|
| 1 bit | 2 (black and white) |
| 8 bits | 256 |
| 24 bits | 16 777 216 |
Estimating the file size
Divide by 8 for bytes (and by 1024 for each larger binary unit). The header adds a little extra.
Worked example
A image has a 24-bit colour depth.
Changing the image
- Higher resolution or colour depth: better quality (more detail and colours) but a larger file.
- Lower resolution or colour depth: smaller file but lower quality (blocky pixels or fewer shades).
- Enlarging a bitmap makes the pixels visible (it becomes pixelated).
Common mistake: forgetting to divide by 8 to convert bits to bytes. Also, don't mix up image resolution (pixels in the image) with screen resolution (pixels on the display), or colour depth with the number of colours.
Exam tip: write the formula in words, substitute, and show each conversion step (bits, bytes, then KiB or MiB). Use the terms pixel, resolution and colour depth accurately.
Check yourself
How many colours can an 8-bit colour depth represent?
.
Find the file size in bytes of a image with 8-bit colour depth.
bytes.
What is stored in a file header?
Information such as the image width, height and colour depth.