Data Storage and Compression
Data Representation
This comparison comes up regularly in exam questions worth 3 to 4 marks.
| Feature | Lossless | Lossy |
|---|---|---|
| Is any data lost? | No | Yes (permanently) |
| Can the original be reconstructed? | Yes, perfectly | No |
| Typical size reduction | Modest (1.5× to 4×) | Large (10× or more) |
| Effect on quality | None; quality identical to the original | Quality is reduced |
| Best for | Text documents, source code, archives, anywhere every bit matters | Photos, music, video, anywhere small size matters and minor quality loss is acceptable |
| Examples | PNG, FLAC, ZIP, GIF, RLE, PDF text | JPEG, MP3, MPEG/H.264, AAC |
Common exam question
Explaining why lossless is chosen instead of lossy
Question: Explain why someone would compress a file with lossless rather than lossy compression, or why lossy compression is not suitable for that file (3 marks).
Asked in 2 of the 17 papers, both for 3 marks, and both answers are built from the same chain of points. Lossy compression permanently removes data; that data could be important, so for a text document the file would be damaged or corrupted, and for a sound recording or an image the quality would be reduced. Lossless compression removes nothing permanently, so the original can be restored, kept at its highest quality or edited later.
Tie each point to the file in the question: a report with text and pictures, a recording the musician still wants to edit. "No data is lost" is one of the three marks, not all of them, so develop it into what lossy would do to this particular file.
Choosing which to use
- If the file is a text document or spreadsheet, choose lossless: a single missing word changes the meaning.
- If the file is source code or a database backup, choose lossless: a single missing bit can crash the program.
- If the file is a photograph for a website, choose lossy: a 10× smaller image that looks almost identical is a much better user experience.
- If the file is a music track to stream over a mobile network, choose lossy: most users cannot hear the difference between a 320 kbps MP3 and the studio master, and the smaller size saves bandwidth.