Basics of Computer Science · Lesson 2b
3 minutes to read · one thing to invent
You now know a computer stores everything as 0s and 1s. Which leaves the obvious question.
How does a photo of a dog fit down a wire?
Text, images, sound, video — they all use one idea, repeated:
Step 1 is the interesting one, because it is a decision, not a fact. Somebody chose it, and everyone else agreed to follow.
Someone decided that capital A would be 65. There is no deep reason. It could have been 12. But because everyone agreed, your phone and a server on the other side of the planet read the same bits the same way.
That agreement is called ASCII, and the modern version — Unicode — covers 154,998 characters, including every emoji you have ever sent.
A photo is a grid of coloured dots. Each dot is three numbers: how much red, how much green, how much blue, each from 0 to 255.
That is it. That is the whole idea. A picture is just a very long list of numbers.
A single HD video frame is 1920 × 1080 pixels — that is 2,073,600 dots, three bytes each, so 6,220,800 bytes for one frame.
Video runs at 24 frames per second. A 90-minute film, stored this way, would be about 806 GB.
Your phone streams that film over mobile data. So what did we get wrong?
Hold that thought. It is one of the best answers in the whole course.
Invent your own code.
Take a small drawing — 8 × 8 squares on paper is plenty. Fill some squares in, leave others blank. Now write it as bits: 1 for filled, 0 for blank, row by row.
Hand only the digits to someone else — no picture, no explanation beyond the rule. Can they redraw it exactly?
If they can, you have just done what every image file on Earth does.
Bring to the lesson
Encode your own name byte by byte, work out exactly how big an uncompressed song is, and see what happens when two computers disagree about which code they are using.