Image Representation: Bitmaps
A bitmap represents an image as a rectangular grid of pixels. Each pixel stores a colour value. The amount of detail and the amount of storage required depend mainly on the resolution and colour depth.
Learning Objectives
- 11.1.1.5 Explain how bitmaps are represented in terms of number of pixels, resolution, and colour depth
- 11.1.1.6 Calculate the size of a bitmap image file
How a Bitmap Represents an Image
The smallest addressable picture element in a bitmap image.
The pixel dimensions of the image, usually written as width × height.
The number of bits used to represent the colour of one pixel.
Resolution in these calculations
In this topic, resolution is normally given as pixel dimensions such as 1920 × 1080. Pixel density such as PPI is related, but it is not used in the bitmap-size formula unless a question explicitly asks for it.
Resolution & Number of Pixels
1 Calculate total number of pixels
Resolution = 1920 × 1080
Total pixels
= width × height
= 1920 × 1080
= 2,073,600 pixels
≈ 2.07 megapixels| If resolution increases... | Effect |
|---|---|
| Number of pixels | Increases |
| Possible image detail | Generally increases |
| Uncompressed storage requirement | Increases if colour depth stays the same |
Doubling both dimensions does not double the pixels
800 × 600 = 480,000 pixels, but 1600 × 1200 = 1,920,000 pixels — four times as many.
Colour Depth
2 Number of possible colours
Number of colours = 2^(colour depth)
1 bit → 2¹ = 2 colours
4 bits → 2⁴ = 16 colours
8 bits → 2⁸ = 256 colours
24 bits → 2²⁴ = 16,777,216 colours24-bit RGB
A common 24-bit representation uses 8 bits for red + 8 bits for green + 8 bits for blue. The colour depth is 24 bits per pixel, not 24 bits per channel.
| If colour depth increases... | Effect |
|---|---|
| Bits stored per pixel | Increases |
| Possible colours | Increases exponentially: 2^n |
| Colour detail / gradients | Can improve |
| Uncompressed file size | Increases if resolution stays the same |
Calculating Bitmap Image Size
Uncompressed pixel data (bits)
= width × height × colour depth3 Example: 640 × 480, 8-bit colour
Number of pixels
= 640 × 480
= 307,200 pixels
Size in bits
= 307,200 × 8
= 2,457,600 bits
Size in bytes
= 2,457,600 ÷ 8
= 307,200 bytes
Size in KiB
= 307,200 ÷ 1024
= 300 KiB4 Example: 1920 × 1080, 24-bit colour
Size in bits
= 1920 × 1080 × 24
= 49,766,400 bits
Size in bytes
= 49,766,400 ÷ 8
= 6,220,800 bytes
Size in MiB
= 6,220,800 ÷ 1024 ÷ 1024
≈ 5.93 MiBUnit conversions
This page uses 1024 bytes = 1 KiB and 1024 KiB = 1 MiB. If an exam question explicitly gives a different conversion such as 1000 bytes = 1 kB, use the conversion stated in the question.
Formula result vs actual file size
width × height × colour depth calculates the raw, uncompressed pixel data. A real image file may also contain headers/metadata, and some formats may use compression, so its actual size on disk can differ.
The Quality–Storage Trade-off
| Change | Possible benefit | Cost |
|---|---|---|
| Increase resolution | More spatial detail | More pixels to store |
| Increase colour depth | More possible colours / smoother gradients | More bits for every pixel |
| Reduce resolution / colour depth | Less storage and bandwidth | Possible loss of image detail or colour quality |
Interactive Labs
1. Resolution Calculator
2. Colour Depth Challenge
3. Bitmap Size Calculator
4. Predict the Effect
Common Pitfalls
Resolution is not colour depth
Resolution describes how many pixel positions the image has. Colour depth describes how many bits are used for each pixel.
Colour depth is not the number of colours
An 8-bit colour depth does not mean 8 colours. It gives 2^8 = 256 possible colour values.
Forgetting bits → bytes
After width × height × depth, the result is in bits. Divide by 8 to obtain bytes.
Raw formula ≠ every actual file size
Headers, metadata and compression can change the size of a real image file.
Doubling width and height
Doubling both dimensions multiplies the number of pixels by four, not two.
Graded Tasks
Define pixel, resolution and colour depth.
Explain how a bitmap image is represented digitally.
Calculate the total number of pixels in a 1280 × 720 image.
Calculate the number of possible colours for 4-bit, 8-bit and 16-bit colour depth.
Explain two effects of increasing the resolution while keeping colour depth unchanged.
Calculate the uncompressed size in bytes of a 1024 × 768 image with 8-bit colour depth.
Compare two 800 × 600 images with colour depths of 8 bits and 24 bits. Explain the effect on possible colours and storage.
A developer needs to reduce image storage. Discuss the consequences of reducing resolution versus reducing colour depth.
Exam Practice
Q1: Explain how a bitmap image is represented using pixels and colour depth. [3]
Reveal marking points
Q2: An image has a resolution of 1600 × 900. Calculate the total number of pixels. [1]
Reveal marking points
Q3: A bitmap uses 6-bit colour depth. Calculate the maximum number of possible colours. [2]
Reveal marking points
Q4: A 640 × 480 bitmap uses 16-bit colour depth. Calculate its uncompressed pixel-data size in bytes. [3]