# Binary representation of images

> CIE A-Level Computer Science · 9618
> Source: https://www.owlsprep.com/study/cie-9618-u1-binary-representation-of-images/

This module explains how digital images are stored as binary data, covers core concepts of pixels, resolution and colour depth, teaches file size calculation, and compares bitmap and vector image formats for CIE 9618 Paper 1.

**Prerequisites:** [Binary number representation](https://www.owlsprep.com/study/cie-9618-u1-binary-number-system/); [Units of digital data (bits, bytes)](https://www.owlsprep.com/study/cie-9618-u1-units-of-information/)

## Learning objectives

- Explain how bitmap images are represented as binary data
- Define pixel, resolution and colour depth and calculate image file size
- Compare the properties of bitmap and vector image formats
- Identify appropriate use cases for bitmap and vector images

## Core Concepts: Pixels, Resolution and Colour Depth

**Pixel** — Short for "picture element", the smallest individual unit of a bitmap image that stores colour information.

*Example:* A 1920×1080 image contains 2,073,600 individual pixels.

Every pixel is assigned one or more bits to represent its colour. The number of bits used per pixel is called **colour depth**, and the total number of unique colours available is $2^n$ where $n$ is the colour depth.

**Colour Depth** — The number of bits used to store the colour value of a single pixel in a bitmap image. Higher colour depth produces more realistic colour gradients.

*Example:* A 1-bit image has only 2 possible colours (usually black and white).

**Worked example:** An image uses 24-bit colour depth. How many unique colours can it display?

1. Use the formula for total number of possible colours:
2. $$\text{Total colours} = 2^\text{colour depth}$$
3. Substitute the given colour depth value of 24:
4. $$2^{24}$$
5. Calculate the result:
6. $$2^{24} = 16777216$$
7. 24-bit colour is often called "true colour" because it can reproduce almost all visible colours.

> **Exam tip:** Always check if the question asks for number of colours or number of bits — mix-ups are a common source of lost marks.

## Calculating Bitmap Image File Size

The total file size of a bitmap image depends directly on its resolution (total number of pixels) and colour depth. The base formula for file size in bits is:

$$\text{Total file size (bits)} = \text{width (pixels)} \times \text{height (pixels)} \times \text{colour depth (bits per pixel)}$$

To convert to larger units, divide by 8 for bytes, 1024 for kilobytes, $1024^2$ for megabytes, etc. CIE always uses binary prefixes (1 KB = 1024 bytes) for these calculations.

**Worked example:** Calculate the file size (in kilobytes) of a 800×600 pixel image with 16-bit colour depth.

1. 1. Calculate total number of pixels:
2. $$800 \times 600 = 480000$$
3. 2. Calculate total file size in bits:
4. $$480000 \times 16 = 7680000$$
5. 3. Convert bits to bytes by dividing by 8:
6. $$7680000 \div 8 = 960000$$
7. 4. Convert bytes to kilobytes by dividing by 1024:
8. $$960000 \div 1024 = 937.5$$

> **Exam tip:** Always show all working steps — you will get method marks for correct steps even if your final arithmetic is wrong.

## Bitmap vs Vector Image Representation

Digital images are stored in two main formats, with very different binary representation approaches. CIE regularly asks to compare these formats and their use cases.

**Bitmap (Raster) Image** — An image stored as a grid of pixels, where each pixel stores its own individual colour value as binary.

**Vector Image** — An image stored as a set of binary-encoded mathematical descriptions of geometric primitives (lines, shapes, curves), not per-pixel colour values.

| Property | Bitmap | Vector |
| --- | --- | --- |
| Scaling | Pixelates when scaled up | No quality loss when scaled |
| File size | Large for high resolutions | Small for simple graphics |

**Worked example:** A designer needs a company logo that will be used on a business card and a large billboard. Which format should they use? Justify your answer.

1. 1. Identify the key requirement: the logo must be resized to very different dimensions without losing quality.
2. 2. Recall properties: Bitmap images store fixed pixel data, so scaling up causes pixelation. Vector images store shapes as mathematical properties, so they scale without quality loss.
3. 3. Conclusion: Vector format is the appropriate choice.

## Common pitfalls

- **Wrong:** Forgetting to convert bits to bytes when asked for file size in bytes/KB/MB
  - Why it fails: The base file size formula gives a result in bits, not bytes. This is the most common error in this topic.
  - Correct: Always divide the total bit count by 8 before converting to larger storage units.
- **Wrong:** Using 1000 instead of 1024 for unit conversion
  - Why it fails: CIE uses binary prefixes for all file size calculations in 9618, not decimal prefixes.
  - Correct: Use 1 KB = 1024 bytes, 1 MB = 1024 KB for all CIE questions.
- **Wrong:** Claiming vector images are not stored as binary
  - Why it fails: All digital data is stored as binary — only the representation of the image differs.
  - Correct: State that vector geometric properties are encoded as binary, rather than per-pixel colour values.
- **Wrong:** Calculating number of colours as $2n$ instead of $2^n$ for colour depth $n$
  - Why it fails: Each bit adds a factor of 2 to the number of possible combinations, not a linear addition.
  - Correct: Always use $\text{number of colours} = 2^n$ where $n$ is colour depth in bits.
- **Wrong:** Confusing resolution and colour depth when describing image quality
  - Why it fails: Both affect quality, but they are separate concepts that are often tested in differentiation questions.
  - Correct: Resolution describes number of pixels (detail), colour depth describes number of bits per pixel (colour accuracy).

## Cheatsheet

| Concept | Key Fact / Formula |
| --- | --- |
| Pixel | Smallest unit of bitmap image |
| Number of colours | $2^n$, $n$ = colour depth (bits) |
| Bitmap file size (bits) | width × height × colour depth |
| Bits → Bytes | Divide by 8 |
| Bytes → Kilobytes | Divide by 1024 |
| Best for photos | Bitmap |
| Best for logos | Vector |
| Lossless scaling | Vector |

## What's next

Binary image representation is a core, frequently assessed topic for CIE 9618 Paper 1, building on your foundational knowledge of binary and data units. Short and medium answer questions on file size calculation and bitmap/vector comparison are almost guaranteed to appear, so mastering these concepts secures easy marks in the exam. Next, you will explore binary representation of other multimedia data types, before learning about data compression, which is used to reduce the storage size of images for transmission and saving.

- [Binary representation of sound](https://www.owlsprep.com/study/cie-9618-u1-binary-representation-of-sound/)
- [Data compression](https://www.owlsprep.com/study/cie-9618-u1-data-compression/)
- [Communication](https://www.owlsprep.com/study/cie-9618-u2-overview/)

---

From [OwlsPrep](https://www.owlsprep.com) — free study guides for A-Level, IB, AP and IGCSE, written against the official syllabus. Canonical page: https://www.owlsprep.com/study/cie-9618-u1-binary-representation-of-images/
