Show understanding of why compression is required, give examples of lossless and lossy techniques for all major media types (text, bitmap, vector, sound, video and binary data), and justify the most appropriate method in a given situation.
A school wants to store 500 MB of instructional video on a 1 GB USB stick. Explain why compression is required and state which type of compression (lossless or lossy) would be most appropriate, giving one reason for your choice.
| Aspect | Lossless | Lossy |
|---|---|---|
| Data integrity | Exact original data can be recovered | Original data is approximated; some information is lost |
| Typical compression ratio | 2 : 1 – 3 : 1 (up to ≈5 : 1 for highly redundant data) | 10 : 1 – 100 : 1 (depends on content and quality settings) |
| Common applications | Source code, text documents, executables, archival storage, medical images, video in lossless mode | Photographs, music, streaming video, web graphics, most consumer video files |
| Algorithm examples | Run‑Length Encoding (RLE), Huffman, LZW, DEFLATE, Arithmetic coding, PNG/FLAC/ZIP | JPEG, MP3, AAC, H.264 / H.265 / VP9 / AV1, WebP (lossy mode) |
String: ABRACADABRA
| Symbol | Frequency |
|---|---|
| A | 5 |
| B | 2 |
| R | 2 |
| C | 1 |
| D | 1 |
Building the Huffman tree (merge two lowest‑frequency nodes each step):
Resulting codes (left‑branch = 0, right‑branch = 1):
| Media type | Lossless formats / tools | Lossy formats / tools |
|---|---|---|
| Text files | ZIP, GZIP, BZIP2, 7z (DEFLATE), LZMA | — (text is almost never compressed lossily) |
| Bitmap images | PNG, BMP (RLE), TIFF (LZW or ZIP), lossless WebP | JPEG, WebP (lossy), HEIF (HEIC) |
| Vector graphics | SVG + gzip (SVGZ), PDF‑optimised streams, EPS with LZW compression | Simplification / point‑reduction algorithms (e.g., SVG path‑simplify) – a form of lossy reduction |
| Sound files | FLAC, ALAC, WAV (compressed with DEFLATE), Apple Lossless | MP3, AAC, OGG Vorbis, Opus |
| Video files | FFV1, H.264 lossless mode, Apple ProRes (visually lossless), AV1 lossless | H.264/AVC, H.265/HEVC, VP9, AV1, MPEG‑2 |
| Binary / executable files | ZIP, GZIP, 7z, LZMA, UPX (executable packer – lossless) | — (binary data is never compressed lossily) |
| Web pages (HTTP transfer) | Brotli, GZIP, Deflate (applied to HTML, CSS, JavaScript) | — (compression is lossless for web assets) |
Scenario: You need to publish a technical diagram (vector graphic) on the school website. The original SVG file is 2 MB. Which compression method should you use and why?
gzip the SVG (producing an .svgz file). .svgz, so no extra client‑side processing is needed.Compression is essential for efficient storage and transmission. Understanding the trade‑off between lossless (exact reconstruction, modest ratios) and lossy (higher ratios, some quality loss) enables you to select the most suitable technique for each media type—text, bitmap, vector, sound, video or binary data. Familiarity with key algorithms (RLE, Huffman, LZW, arithmetic coding, JPEG, MP3, H.264/HEVC) and awareness of their impact on CPU, memory, latency and energy help you justify choices in exam questions and in real‑world system design.
Create an account or Login to take a Quiz
Log in to suggest improvements to this note.
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.