Skip to content

Lossy and Lossless Compression

1.3.1 Compression, encryption and hashing · Paper 1 · 5 flashcards · 5 questions

Compression is essential in modern computing - without it, storing and transmitting large files like videos, images, and documents would be impractical. There are two fundamentally different approaches to compression, each with specific use cases.

Definition
Compression is the process of reducing the size of a file, enabling more efficient storage and faster transmission over networks.

Lossy Compression

Lossy compression achieves dramatic file size reductions by permanently removing data - specifically, the parts that are least noticeable to human perception. Once compressed, the original data cannot be fully recovered.

Definition
Lossy compression permanently removes some data (typically the least noticeable parts) to achieve significant file size reduction. The original file cannot be perfectly reconstructed.
Key Point
How Lossy Compression Works:
• Analyses data to identify less important information
• Removes data that humans are less likely to notice
• JPEG removes colour variations the eye can't distinguish
• MP3 removes frequencies outside normal hearing range
• The more compression, the more quality loss
Example
JPEG Image Compression:
Original photo: 10 MB
High quality JPEG (90%): 2 MB - minimal visible difference
Medium quality JPEG (50%): 500 KB - some blur/artifacts visible
Low quality JPEG (10%): 100 KB - significant quality loss, blocky artifacts

MP3 Audio Compression:
Original WAV: 50 MB
320 kbps MP3: 10 MB - near-CD quality
128 kbps MP3: 4 MB - acceptable quality for most listeners
64 kbps MP3: 2 MB - noticeable quality loss
Exam Tip
When to use Lossy: Media files where perfect reproduction isn't required - photos for web, music for portable devices, streaming video. NEVER for text, code, or medical images.

Lossless Compression

Lossless compression reduces file size without losing any data - the original can be perfectly reconstructed. This is achieved by finding and encoding patterns in the data more efficiently.

Definition
Lossless compression reduces file size without losing any data. The original file can be perfectly reconstructed from the compressed version.
Key Point
How Lossless Compression Works:
• Identifies patterns and redundancy in data
• Encodes repeated patterns with shorter representations
• No information is discarded
• Decompression perfectly restores original
• Compression ratio depends on data patterns
Example
ZIP File Compression:
A folder of text documents might compress from 100 MB to 20 MB (80% reduction) because text has many repeating patterns.

A folder of already-compressed JPEGs might only go from 100 MB to 98 MB (2% reduction) because there's little redundancy left to exploit.

Comparison

Key Point
Data Lost?
• Lossy: Yes - permanently
• Lossless: No - perfect reconstruction

Compression Ratio
• Lossy: High (often 90%+)
• Lossless: Lower (typically 50-70%)

Best For
• Lossy: Images, audio, video
• Lossless: Text, code, documents, archives

Examples
• Lossy: JPEG, MP3, MPEG, H.264
• Lossless: ZIP, PNG, FLAC, GIF

Quality
• Lossy: Degrades with more compression
• Lossless: Always perfect