Encoding and decoding a small colour image

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

Encoding and decoding a small colour image

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A small image uses 4 colours. How many bits are needed for each pixel's colour code?
A 4 bits per pixel
B 2 bits per pixel
2. Using the table 00 = white, 01 = red, 10 = blue, 11 = black, which row of 4 pixels is encoded as 01 00 11 10?
A red, white, black, blue
B white, red, blue, black
3. How do you encode a small image into binary?
A Write the binary number of the total pixel count and nothing else
B Look up each pixel's colour in the table and write its code, row by row
4. A 3 x 2 image (3 pixels wide, 2 rows) uses 2-bit colour codes. How many bits does the binary data use in total?
A 12 bits
B 6 bits
5. An image needs 5 different colours. Which colour depth is the smallest that works?
A 3 bits per pixel
B 2 bits per pixel

Match the Pairs

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

Left columnRight column
101 10 10 01 A00, 01, 10, 11
200 11 00 11 BA row of 4 pixels: black, red, red, black (table: 00 white, 01 black, 10 red, 11 blue)
3An image with 4 colours needs 2 bits per pixel, so its colour code table has four different codes COnly 1 bit is used, so there are just 2 codes (0 and 1). The codes repeat and the colours cannot be told apart. 4 colours need 2 bits.
4To find the size of an encoded image, multiply the pixels in the grid by the bits per pixel DThe code was read 1 bit at a time. With a 2-bit table the bits must be read in pairs: 01 10 is black, red.
50 = white, 1 = black, 0 = red, 1 = blue E4 pixels x 3 rows x 2 bits = 24 bits
60110 = white, black, black, white FA row of 4 pixels: white, blue, white, blue (table: 00 white, 01 black, 10 red, 11 blue)

Definitions

colour code table

Fill in the Blanks

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

1.
4 colours need _ bits for each pixel
2.
table: 00=white, 01=red, 10=blue, 11=black row 1: red, blue, white code: 01 __ 00
3.
table: 00=white, 01=red, 10=blue, 11=black row: 11 01 00 colours: black, ___, white
4.
5 colours need _ bits for each pixel
5.
4 pixels x 2 bits = _ bits in each row

Spot the Error

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

Question 1
A Colours needed: 4
B Bits per pixel: 1
C 00=white 01=black
D 10=red 11=blue
Question 2
A 00=white 01=black
B 10=red 11=blue
C Row 1: black red = 01 11
Question 3
A Table: 10=red, 11=blue
B Red pixel is 11
C Blue pixel is 11
Question 4
A 00=white 01=black
B 10=red 11=blue
C Row 2: blue blue white red
D Binary: 11 11 10 00
Question 5
A 00=white 01=black 10=red
B Code: 01 00 10
C Row 1: black red white

Answer Key

Encoding and decoding a small colour image
Section A: Quick Questions
Q1
B — 2 bits per pixel
Q2
A — red, white, black, blue
Q3
B — Look up each pixel's colour in the table and write its code, row by row
Q4
A — 12 bits
Q5
A — 3 bits per pixel
Section B: Match the Pairs
Q1
01 10 10 01 → A row of 4 pixels: black, red, red, black (table: 00 white, 01 black, 10 red, 11 blue)
Q2
00 11 00 11 → A row of 4 pixels: white, blue, white, blue (table: 00 white, 01 black, 10 red, 11 blue)
Q3
An image with 4 colours needs 2 bits per pixel, so its colour code table has four different codes → 00, 01, 10, 11
Q4
To find the size of an encoded image, multiply the pixels in the grid by the bits per pixel → 4 pixels x 3 rows x 2 bits = 24 bits
Q5
0 = white, 1 = black, 0 = red, 1 = blue → Only 1 bit is used, so there are just 2 codes (0 and 1). The codes repeat and the colours cannot be told apart. 4 colours need 2 bits.
Q6
0110 = white, black, black, white → The code was read 1 bit at a time. With a 2-bit table the bits must be read in pairs: 01 10 is black, red.
Section C: Definitions
Q1
colour code table — A table giving each colour a binary code. Write each pixel's code row by row to encode an image; read the codes back to redraw it. 4 colours need 2 bits.
Section D: Fill in the Blanks
Q1
4 colours need 2 bits for each pixel
Q2
table: 00=white, 01=red, 10=blue, 11=black row 1: red, blue, white code: 01 10 00
Q3
table: 00=white, 01=red, 10=blue, 11=black row: 11 01 00 colours: black, red, white
Q4
5 colours need 3 bits for each pixel
Q5
4 pixels x 2 bits = 8 bits in each row
Section E: Spot the Error
Q1
B — 1 bit only gives 2 codes (0 and 1), so it can't store 4 colours. 4 colours need 2 bits per pixel.
Q2
C — In the colour code table red is 10, not 11 (11 is blue). The row should be 01 10.
Q3
B — The colour code table says red is 10. 11 is the code for blue.
Q4
D — The codes must follow the pixel order. The third pixel is white (00) and the fourth is red (10), so it should be 11 11 00 10.
Q5
C — Decoding reads the codes in order: 01 is black, 00 is white, 10 is red. The row should be black white red.