← Back to course
2/6
Week 03 Β· Pictures as Numbers

Tuesday

Colors as numbers
// Pixels and color values
⏱ about 15 min

Tuesday: Colors as Numbers

Rocket opens the code for one plant photo. "There are no colors here," he groans. "Only numbers!"

Raven reads the first line: 255, 0, 0. "What do you notice? Every pixel has three numbers."

Nova blinks red, then green, then blue. "Here is a hint," she says. "Three numbers, three lights."

Rocket counts the blinks. Red, green and blue!

Red, green and blue

A screen makes each pixel's color by mixing light.

It mixes red, green and blue light. We call this RGB.

So a computer keeps three numbers for each pixel: red, green and blue.

Each number goes from 0 to 255.

A 0 means none of that light. A 255 means the most of that light.

RedGreenBlueColor you see
25500red
02550green
00255blue
000black (no light at all)
255255255white (all three at the most)
READ THE NUMBERS
  • Read the question.
  • Tap your answer.
A pixel has red 0, green 0, blue 255. What color is it?
A pixel has red 0, green 0, blue 0. What color is it?
A pixel has red 255, green 0, blue 0. What color is it?
How many numbers does each pixel need?

From 0 to 255

The smallest color value is 0. The biggest is 255.

A bigger number means more of that light.

A blue value of 200 has more blue light than a blue value of 50.

Color valueCould it be a real color value?
0?
255?
128?
300?
500?
WHY THIS EXERCISEEvery red, green or blue value must be between 0 and 255.
The smallest color value is ____.
The biggest color value is ____.
RGB stands for red, green and ____.
MORE OR LESS LIGHT?
  • Read the question.
  • Tap your answer.
Which pixel has more blue light: blue 200 or blue 50?
Which pixel has more red light: red 10 or red 240?
A tiny photo has 4 pixels. Each needs 3 numbers. How many numbers in all?
WHY THIS EXERCISEEven a tiny photo needs lots of numbers, three for every pixel.

Awesome number reading! Tomorrow you will paint a picture from a number grid.

← Monday