Open the editor

Computer science · High school

Data Compression Slides

Free animated slides, ready to teach: 6 slides where every step appears on a click and the diagrams move. Play them right here, present them full screen, or copy them into your account to edit.

A real Tracé deck playing in your browser. No account needed.

What the lesson covers

Compression makes files smaller by storing the same information in fewer bits. Students squeeze a row of pixels with run-length encoding, compare lossless and lossy methods and work out a compression ratio.

The slides, one by one

1 Compression

The same data in fewer bits

How does a 12 MB photo become a 2 MB JPEG?

2 Run-length encoding stores each run once

Count, then value: 6W 3B 4W

Great for long runs, useless for noise

3 Lossless rebuilds exactly; lossy does not

Lossless

  • Exact copy back
  • Text, code, PNG, ZIP
  • Smaller savings

Lossy

  • Drops detail we barely notice
  • Photos, music, video
  • Much smaller files

Never use lossy compression for text or programs

4 Compressing a row of pixels

A row of 20 pixels is 8 white, 4 black, 8 white. Each pixel takes 1 byte; each run takes 2 bytes (count and colour). Find the sizes and the ratio.

→ Size before ÷ size after

\text{Before: } 20 \times 1 = 20\ \text{bytes}
\text{Runs: } 8W,\ 4B,\ 8W = 3 \text{ runs}
\text{After: } 3 \times 2 = 6\ \text{bytes}
\text{Ratio} = 20 / 6 \approx 3.3 : 1

20 bytes become 6: a ratio of about 3.3 : 1

5 Quick check

Decode the run-length code 3A2B1C.

  • AAABBC
  • ABC
  • 3A2B1C
  • AAABBBCCC
Show the answer

AAABBC

Each pair is a count then a symbol: 3 A, 2 B, 1 C.

6 What to remember

Compression: fewer bits, same information

RLE: store count + value for each run

Lossless: exact; lossy: smaller, not exact

Ratio = size before ÷ size after

Challenge: Why can RLE make a file bigger? Try it on ABABABAB.

Every slide is built click by click: text, formulas and pictures come in one step at a time, so the class follows the reasoning instead of reading ahead. Graphs with sliders can be dragged live while you present.

Make your own version with AIChange the level, the numbers or the language: type the topic and get a new deck that moves in about 30 seconds. Free, no account needed.

Questions teachers ask

What is the difference between lossless and lossy compression?

Lossless compression (run-length encoding, ZIP, PNG) rebuilds the original exactly. Lossy compression (JPEG, MP3) throws away detail people barely notice, so files get much smaller but the original cannot be rebuilt.

Are these slides really free?

Yes. Watch them on this page or present them full screen with no account. Making your own copy to edit is free too.

Can I change the slides before my lesson?

Yes. Press "Make my own copy" and the deck becomes one of your projects in the Tracé editor, where you can change the text, the numbers, the colours or the order of the clicks.

Do they work on a classroom projector or an interactive whiteboard?

Yes. They run in the browser on any laptop, so anything that shows your screen works. Press the right arrow or click to go to the next step.