Show understanding of how data for a bitmapped image are encoded
1.2 Multimedia
What is a bitmapped image?
📷 A bitmapped image is like a giant mosaic made of tiny coloured squares called pixels. Each pixel stores colour information in binary form.
Think of a pixel as a tiny light bulb that can show a colour. The whole picture is just a grid of these bulbs turned on in different colours.
How are pixels encoded?
Every pixel is represented by a fixed number of bits, called the colour depth:
- 1‑bit → black or white (2 colours)
- 4‑bit → 16 colours
- 8‑bit → 256 colours (grayscale or indexed colour)
- 24‑bit → 16 777 216 colours (8 bits for each of R, G, B)
For a 24‑bit image each pixel uses 3 bytes:
R G B 8b 8b 8b
In binary a pixel can be written as:
RGB
Mathematically we can combine the three bytes into one 24‑bit integer:
$pixel = (R \ll 16) + (G \ll 8) + B$
Example: 8‑bit Grayscale Image
In a grayscale image each pixel is a single byte (8 bits) that represents brightness from black (0) to white (255).
| Pixel (x,y) | Binary | Decimal | Colour |
|---|---|---|---|
| (0,0) | 00000000 | 0 | Black |
| (1,0) | 11111111 | 255 | White |
| (0,1) | 01111110 | 126 | Grey |
Example: 24‑bit RGB Image
Each pixel is stored as three bytes: Red, Green, Blue.
- Read the first byte → Red component (0–255).
- Read the second byte → Green component (0–255).
- Read the third byte → Blue component (0–255).
For a pixel with RGB values (R,G,B) = (255, 0, 0), the binary representation is:
11111111 00000000 00000000
This represents a bright red pixel.
Compression Techniques
- Run‑Length Encoding (RLE) – stores repeated pixels as a count and value.
- Lossless compression – PNG uses DEFLATE (a combination of LZ77 and Huffman coding).
- Lossy compression – JPEG uses discrete cosine transform (DCT) and quantisation to reduce file size.
🔢 The key idea is to remove redundancy while keeping the image recognisable.
Exam Tips
- State that a bitmapped image is a grid of pixels stored in raster order (left to right, top to bottom).
- Explain colour depth: 1‑bit (black/white), 8‑bit (256 colours), 24‑bit (16 777 216 colours).
- Show how a 24‑bit pixel is encoded as three bytes (R, G, B) and can be combined into a 24‑bit integer: $pixel = (R \ll 16) + (G \ll 8) + B$.
- Remember to mention common compression methods (RLE, PNG, JPEG) and whether they are lossless or lossy.
- Use the analogy of a mosaic or a grid of coloured light bulbs to illustrate the concept.
Good luck! 🎓
Revision
Log in to practice.