Squeezing pictures into less space
Children shrink a picture by writing how many squares in a row are the same, a trick called run-length encoding.
Steps
- Show an 8 by 8 picture made of black and white squares. Ask how you could describe it without naming every square.
- Teach the trick: instead of naming each square, count how many of the same colour come in a row.
- Do the first row together. Start with white. For example, 3 white then 2 black then 3 white becomes 3, 2, 3.
- Let children write the code for the other rows.
- Swap codes with a partner. Each partner colours the picture back from the code.
- Compare: did the code use fewer numbers than the 64 squares?
Talk about it
- Which pictures squeeze well, and which do not?
- Why do computers want to use less space?
- Where have you seen pictures that were sent or saved?
CC BY-SA 4.0
Adapted from CS Unplugged by the University of Canterbury Computer Science Education Research Group (CS Unplugged), licensed CC BY-SA 4.0.
Original lesson, with pictures · License: CC BY-SA 4.0
There are no pictures here. The original lesson has the pictures and printables.
Changes made: Simplified, shortened and translated by Open Cosmos with AI
This adapted lesson is shared under the same license (CC BY-SA 4.0).