Bitmap Images
Bitmaps vs Vectors
Images can be stored in two ways:
| Type | How It Stores the Image | Scalability |
|---|---|---|
| Bitmap | Grid of coloured squares called pixels | Pixelates when enlarged |
| Vector | Mathematical instructions to draw shapes | Scales perfectly at any size |
This note focuses on bitmaps, which are the most common image format in computing.
What Is a Pixel?
A pixel is the smallest individual element of a bitmap image. Each pixel is a single square of colour. The image is a grid of these squares.
Colour Depth
Colour depth is the number of bits used to represent each pixel. More bits = more possible colours.
| Colour Depth | 2^n Colours | Example |
|---|---|---|
| 1 bit | 2 (black/white) | Simple monochrome |
| 2 bits | 4 | Early greyscale |
| 8 bits | 256 | Limited palette |
| 24 bits | 16,777,216 (~16.7 million) | True colour (standard today) |
| 32 bits | 4,294,967,296 | True colour + alpha channel |
24-bit Colour (RGB)
Modern images use 24 bits per pixel: 8 bits each for:
- Red channel (0-255)
- Green channel (0-255)
- Blue channel (0-255)
32-bit Colour (RGBA)
Adds an alpha channel (8 bits for opacity/transparency). Images without transparency (e.g., JPEG) don’t use the alpha channel, it would be wasted.
Resolution
Resolution is the width × height of an image in pixels (e.g., 1920 × 1080).
- Higher resolution = more pixels = sharper image = larger file size
Metadata
Metadata is additional data stored alongside the image that describes it, including:
- Width (in pixels)
- Height (in pixels)
- Colour depth
- Colour palette (for low colour-depth images)
- File format information
File Size Formula
File size (bits) = width × height × colour depth
Example: 100 × 100 image with 32-bit colour depth
= 100 × 100 × 32
= 320,000 bits
= 320,000 ÷ 8 = 40,000 bytes
= 40,000 ÷ 1024 ≈ 39.06 KiB
Factors that increase file size:
- Greater resolution (more pixels)
- Greater colour depth (more bits per pixel)
Exam Questions
Q: Explain the difference between a vector and a bitmap image.
A bitmap stores an image as a grid of coloured pixels. A vector stores mathematical instructions to draw shapes. Vectors can be scaled without quality loss; bitmaps pixelate when enlarged.
Q: Calculate the file size of a 100×100 bitmap with a colour depth of 32.
100 × 100 × 32 = 320,000 bits = 40,000 bytes.
Q: Why is the alpha channel unused in some images?
The alpha channel stores transparency information. Images that do not require transparency (e.g., photographs) do not need it, so it is omitted to save space.
Q: How many colours are possible with a colour depth of 10 bits?
2¹⁰ = 1,024 colours.
Q: What is the purpose of metadata in an image file?
Metadata stores additional information such as the image’s width, height, colour depth and colour palette, which is needed to correctly interpret and display the pixel data.
Exam Tip
The formula is
width × height × colour depthin bits, remember to convert to bytes (÷8) or KiB/MiB (÷1024) as required by the question.