Why Compress?
Compression is the process of making a file smaller. In the exam, you need to know exactly why we do this and the benefits.
Transmission Speed
Smaller files take less time to transmit. This means faster uploads (sending to a server) and faster downloads (loading a webpage).
Storage Space
Compressed files take up less storage space on a disk or server. This prevents email inboxes or servers from becoming full.
Examiner's Warning: Be Specific!
Don't just say "It is faster." Faster to do what?
✓ Correct: "Faster to transmit/download."
✗ Incorrect: "The computer runs faster."
Don't just say "It takes less space."
✓ Correct: "Takes less storage space."
✗ Incorrect: "Takes less room on the screen."
Types of Compression
Must KnowLossy
Removes DataPermanently removes non-essential data from the file. The file cannot be restored to its original state.
- Significantly smaller file size.
- Unnoticeable quality loss (to humans).
- Permanent loss of quality/data.
Lossless
Retains DataTemporarily removes data to store the file more efficiently. The file is fully reconstructed to the original.
- No loss of quality or data.
- Essential for files that need accuracy.
- Less reduction in size than Lossy.
Exam Scenario: Why not use Lossy for Text?
A very common question asks why you cannot use Lossy compression on a text file or code.
The "Don't Do This" Trap:
"The text will look blurry."
"The quality of the font is worse."
The Correct Answer:
"Lossy permanently removes data."
"Text files will become unreadable or lose meaning if data (characters) are missing."
// Original Text
"Meet me at 5pm"
// After Lossy Compression (Data Removed)
"Me_t m_ a_ _pm"
*In reality, the file would likely corrupt entirely and not open.
Quick Knowledge Check
Q: Why is lossy compression suitable for a video clip?
Answer:
It reduces the file size significantly. The data removed (like similar colours or high frequencies) is usually not noticeable by humans, so the video is still viewable.
Q: Which compression method is used for a Python script?
Answer: Lossless.
Code cannot have any data removed, or the program will crash (syntax errors). It must be perfectly reconstructed.
Q: A student reduces a bitmap's color depth. Is this compression?
Answer: Yes/Related.
Reducing the number of colors reduces the bits per pixel, which lowers the file size. This is a form of manual optimization often accepted as a way to "reduce file size" alongside lossy/lossless compression.