Squash It
A photo can be shrunk to a fraction of its size. Learn why files are compressed, tell lossless from lossy, and squash a run of pixels yourself with run-length encoding.
Revise this, the fun way
Play it interactively, earn XP and build a streak, free.
Start revising freeWhat you'll cover
Making files smaller 🗜️
A single photo can be millions of bytes. **Compression** squashes a file down so it takes less space and travels faster across the internet. There are two kinds: **lossless**, which keeps every last bit, and **lossy**, which throws some data away to shrink the file further. This module tells them apart.
The language of compression 🔑
Four ideas run through this module:
Lossless and lossy ⚖️
The two methods trade quality against file size in opposite ways.
Which can be undone? ♻️
Which type of compression lets you restore the original file exactly, with nothing lost?
- Lossless compression
- Lossy compression
- Neither type
- Both types equally well
Match each term to its meaning 🔗
- Lossless
- Lossy
- Run-length encoding
- The need for compression
- The original file is restored perfectly
- Some detail is permanently thrown away
- Storing a count next to each repeated value
- Smaller files transfer and store more easily
Why compress? 📉
Select the TWO reasons a business might compress its files.
- To transfer them faster over the internet
- To use less storage space
- To make the files impossible to open
- To add extra detail to the files
Run-length encoding 🏷️
Run-length encoding, or RLE, is a **lossless** method. It replaces a run of the same value with a **count** followed by that value. For example, WWWWWBBB becomes 5W3B. It works brilliantly on images with large blocks of one colour, but adds little where values rarely repeat.
How run-length encoding works 🪜
An interactive activity.
Squash the run 🔢
Using run-length encoding, how is the string AAAABB compressed?
- 4A2B
- A4B2
- AAAABB with no change
- 6AB
Compression in words 🧩
Compression makes a file _____. _____ compression loses no data, so the original is restored perfectly, while _____ compression removes some data for good. Run-length encoding is a lossless method that stores a _____ next to each repeated value. Smaller files also transfer more _____.
True of lossy ✂️
Select the TWO statements that are true about lossy compression.
- It makes smaller files than lossless compression
- Some data is removed permanently
- The original file can be restored exactly
- It is the best choice for a legal document
Spot the true statements 🖍️
An interactive activity.
Choose the method 🧭
An interactive activity.
Lossy or lossless? ✍️
An interactive activity.