Encoding a picture with a colour key

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Encoding a picture with a colour key

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. You have a colour key: 0 = white, 1 = red, 2 = blue. A pixel is red. Which number do you write in the grid?
A 2
B 1
2. Which tells you how to encode a pixel picture with a colour key?
A Write the colour number for each pixel in a grid, row by row
B Write the colour names in a list in any order
3. Why do you give your partner the colour key along with your number grid?
A So they know which colour each number stands for
B So they can see how many pixels are in the picture
4. Your pixel art on squared paper has 4 rows. How many rows will your number grid have?
A 1 row
B 4 rows
5. Key: 0 = white, 1 = green. The top row of squares is white, green, green, white. Which row of numbers is correct?
A 0 1 1 0
B 1 0 0 1

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
11 = red, 2 = blue, 3 = green ATwo colours share the same number, so a partner cannot tell if a 1 means red or blue. Each colour needs its own number.
22 2 1 3 BThe grid row has only two numbers for three pixels. Every pixel needs its own number, so the row should be 1 2 1.
3To encode a pixel, look up its colour in the key and write that colour's number C1 2 1 2 1 2 1 2 1
4Write the numbers row by row, so the grid of numbers has the same shape as the picture DKey: 1 = yellow. Pixel is yellow, so write 1
5Key: 1 = red, 1 = blue EOne row of a number grid: the colour numbers of four pixels, read from left to right
6Picture row: red, blue, red Grid row: 1 2 FA colour key that says which number stands for which colour

Definitions

colour key

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
Key: 1 = red, 2 = blue Pixel colour: blue Pixel number: _
2.
Key: 0 = white, 1 = black, 2 = grey Row 1: black white grey Row 1: 1 0 _
3.
___: 1 = red, 2 = blue, 3 = green
4.
Key: 1 = red, 2 = blue Row 1: 2 1 1 Row 1 colours: blue red ___
5.
Pixel art: 4 across, 3 down Write the numbers row by row Each row has _ numbers

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A key: 0=white 1=red 2=blue
B pixel 1 is red, so write 2
C pixel 2 is white, so write 0
D pixel 3 is blue, so write 2
Question 2
A key: 0=black 1=white
B row 1: black white black
C row 1 code: 1 0 1
Question 3
A key: 1=red 2=green 3=blue
B row 1: green blue red = 2 1 3
C row 2: red red blue = 1 1 3
Question 4
A key: 0=white 1=blue
B row 1: 0 1 0
C row 2: 1 1 1
D row 3: 0 3 0
Question 5
A FOR each row of the picture
B FOR each pixel in the row
C WRITE its colour name
D START a new line

Answer Key

Encoding a picture with a colour key
Section A: Quick Questions
Q1
B — 1
Q2
A — Write the colour number for each pixel in a grid, row by row
Q3
A — So they know which colour each number stands for
Q4
B — 4 rows
Q5
A — 0 1 1 0
Section B: Match the Pairs
Q1
1 = red, 2 = blue, 3 = green → A colour key that says which number stands for which colour
Q2
2 2 1 3 → One row of a number grid: the colour numbers of four pixels, read from left to right
Q3
To encode a pixel, look up its colour in the key and write that colour's number → Key: 1 = yellow. Pixel is yellow, so write 1
Q4
Write the numbers row by row, so the grid of numbers has the same shape as the picture → 1 2 1 2 1 2 1 2 1
Q5
Key: 1 = red, 1 = blue → Two colours share the same number, so a partner cannot tell if a 1 means red or blue. Each colour needs its own number.
Q6
Picture row: red, blue, red Grid row: 1 2 → The grid row has only two numbers for three pixels. Every pixel needs its own number, so the row should be 1 2 1.
Section C: Definitions
Q1
colour key — A list that says which number stands for which colour. To encode a picture, write each pixel's colour number in a grid, row by row, for a partner to decode.
Section D: Fill in the Blanks
Q1
Key: 1 = red, 2 = blue Pixel colour: blue Pixel number: 2
Q2
Key: 0 = white, 1 = black, 2 = grey Row 1: black white grey Row 1: 1 0 2
Q3
Key: 1 = red, 2 = blue, 3 = green
Q4
Key: 1 = red, 2 = blue Row 1: 2 1 1 Row 1 colours: blue red red
Q5
Pixel art: 4 across, 3 down Write the numbers row by row Each row has 4 numbers
Section E: Spot the Error
Q1
B — The colour key says 1 stands for red and 2 stands for blue. A red pixel must be written as 1, not 2.
Q2
A — The key is swapped. The code 1 0 1 for black white black only works if 1=black and 0=white, so the key must be 0=white 1=black.
Q3
B — Green is 2, blue is 3 and red is 1 in the key. So green blue red must be written 2 3 1, not 2 1 3.
Q4
D — The key only has the numbers 0 and 1. The number 3 is not in the key, so no colour matches it. Row 3 should be 0 1 0.
Q5
C — An encoded grid holds numbers, not words. Use the colour key to write the pixel's colour number.