Justify the use of a bitmap image or a vector graphic for a given task, using technical, quantitative, ethical, and security considerations.
| Model | Typical Use | Bits per Channel | Maximum Colours |
|---|---|---|---|
| RGB | Screen display, web graphics | 8 bits (24‑bit total) | 16 777 216 |
| CMYK | Print media | 8 bits per channel (32‑bit total) | ≈ 4 billion |
| YUV / YCbCr | Video compression, broadcasting | 8 bits per component | 16 777 216 (luma + chroma) |
Bit‑depth determines the number of possible colour values per pixel. For a bitmap:
\[
\text{File size (bits)} = \text{width} \times \text{height} \times \text{bit‑depth}
\]
Example: a 800 × 600 image at 8‑bit greyscale (1 channel) needs 800 × 600 × 8 = 3 840 000 bits ≈ 460 KB.
| Aspect | Bitmap Image | Vector Graphic |
|---|---|---|
| Storage | Size ∝ number of pixels (w × h) × colour depth. | Size ∝ number of geometric primitives; independent of display dimensions. |
| Scalability | Enlargement → pixelation; reduction → loss of detail. | Infinite scalability – shapes are recalculated mathematically. |
| Editing | Pixel‑level manipulation; costly for large images. | Object‑level editing (move, recolour, reshape) without affecting other parts. |
| Typical Uses | Photographs, textures, complex gradients. | Logos, icons, technical diagrams, fonts, maps. |
| Rendering Speed | Already rasterised – fast display. | Rasterised on‑the‑fly; may be slower for very complex scenes. |
| File Formats | JPEG (lossy), PNG (lossless), GIF, BMP. | SVG (XML), EPS (PostScript), PDF (vector‑capable), AI. |
Photograph: 1920 × 1080 pixels, 24‑bit colour (RGB).
\[
\text{Uncompressed bits}=1920 \times 1080 \times 24 = 49\,766\,400\ \text{bits}
\]
\[
\text{Uncompressed bytes}= \frac{49\,766\,400}{8}=6.22\ \text{MB}
\]
Typical compression results:
Simple SVG logo: 3 paths, 2 text elements, colour/style attributes.
Consider a 1‑D row of 20 pixels (black = 0, white = 1):
0 0 0 0 0 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0
RLE stores value, run‑length pairs:
(0,5) (1,4) (0,3) (1,6) (0,2)
Each pair can be stored in a single byte (4 bits for value, 4 bits for length).
Raw size: 20 bits ≈ 2.5 bytes (rounded to 3 bytes).
RLE size: 5 pairs × 8 bits = 40 bits ≈ 5 bytes.
In this contrived example the RLE is larger, illustrating that compression is data‑dependent. For long runs (e.g., a solid‑colour background) RLE can achieve > 80 % reduction.
Photographic with subtle gradients → Bitmap.
Simple geometric shapes, text, line‑art → Vector.
Must appear at many sizes (e.g., logo on a business card and a billboard) → Vector.
Fixed display size (e.g., a photo in a printed article) → Bitmap.
Small, simple web graphics → Vector (usually < 1 KB).
Large, detailed images → Bitmap with appropriate compression (JPEG, WebP, etc.).
Need to modify individual objects (colour, shape) → Vector.
Need pixel‑level retouching (e.g., skin smoothing) → Bitmap.
Limited hardware (embedded devices) → pre‑rasterised Bitmap for faster display.
Dynamic zooming, animation or interactive diagrams → Vector.
Verify licensing (royalty‑free, Creative Commons, commercial).
Vector libraries often have different attribution requirements than stock photos.
Transmit over HTTPS to protect against tampering.
Strip or encrypt metadata (EXIF) that may contain personal information.
Use checksums (e.g., SHA‑256) to verify file integrity after download.
Requirements: geometric shapes, text, must work on business cards, billboards, and a website.
Recommended format: Vector (SVG or EPS).
Reasons: unlimited scalability, tiny file size, easy colour/shape revisions, and can be compressed (SVGZ) for web delivery.
Requirements: high‑resolution, subtle colour gradients, print‑quality optional.
Recommended format: Bitmap (JPEG for web, PNG for print‑quality).
Reasons: only raster formats can faithfully reproduce photographic detail; compression balances size and quality.
Requirements: roads, landmarks, labels; zoomable without loss of clarity.
Recommended format: Vector (SVG).
Reasons: smooth zoom, crisp labels at any scale, modest file size because the map consists of geometric primitives.
Requirements: pixel‑perfect characters, fixed tile size.
Recommended format: Bitmap (PNG).
Reasons: pixel art relies on exact pixel placement; converting to vector would alter the intended visual style.
Compression (AS 1.3)
Bitmaps benefit from lossy (JPEG, WebP) and lossless (PNG, GIF, LZW) techniques. Vectors are compact by design but can be further gzipped (SVGZ). Understanding RLE, Huffman coding, and LZW helps explain why a 5 MB photograph can shrink to < 0.5 MB while a 10 KB SVG may become 2 KB after gzip.
Ethics & Ownership (7.1)
• Use only properly licensed images – respect copyright, royalty‑free, Creative Commons, or public domain.
• Vector libraries (e.g., Font Awesome, Open‑Source SVGs) often require attribution; stock photos may need purchase or a licence number.
• Document source and licence in project notes to avoid infringement.
Programming Paradigms & Language Translators (A‑Level 2.1)
Pseudocode – loading and displaying graphics:
// Load bitmap (using a library such as Pillow)
bitmap = readBitmap("photo.jpg")
for y = 0 to bitmap.height‑1
for x = 0 to bitmap.width‑1
pixel = bitmap.getPixel(x, y)
// pixel‑level processing …
// Load vector (using a library such as Cairo or SVG.js)
vector = readVector("logo.svg")
for each shape in vector.shapes
draw(shape) // rasterisation occurs here
// shape can be moved, recoloured, scaled …
The bitmap code manipulates a 2‑D array; the vector code works with objects, illustrating “user‑defined data types” and “language translators” (the library translates SVG commands into screen pixels).
Algorithmic Thinking (A‑Level 2.2)
Simple edge‑tracing algorithm to convert a bitmap to a vector (vectorisation):
input bitmap B
output vector V
V ← empty list
for each pixel p in B
if p is an edge (contrast with neighbours)
add line segment approximating p to V
optimise V (merge collinear segments, remove duplicates)
return V
Demonstrates how a computational process can change the representation of visual data.
Communication – Transmitting Graphics (Syllabus 2 – Communication)
image/jpeg, image/png, image/svg+xml).Content‑Length (size) and Cache‑Control (caching policy).Accept‑Encoding request header.System Software – Image‑Processing Libraries (Syllabus 5)
Common libraries that act as language translators for graphics:
Using these libraries demonstrates how high‑level code is translated into low‑level drawing commands executed by the OS.
Security, Privacy & Data Integrity (Syllabus 6)
Use the following sequence of yes/no questions to decide the appropriate format:
Choosing between bitmap and vector graphics requires weighing:
In practice:
Your generous donation helps us continue providing free Cambridge IGCSE & A-Level resources, past papers, syllabus notes, revision questions, and high-quality online tutoring to students across Kenya.