← ACARA Digital Technologies Years 5–6

Encoding a black-and-white image as 0s and 1s

To encode a black-and-white picture, write 1 for each black pixel and 0 for each white pixel. Work row by row, one bit per pixel.

Understanding Encoding a black-and-white image as 0s and 1s in ACARA Digital Technologies Years 5–6

What it does: The key tells everyone how to encode and decode the picture, so each pixel needs just one bit. Each line is one row of 5 pixels. Five rows of five digits make the whole 5 by 5 picture, which here is the number 1. With the key 1 = black, every black pixel is written as a 1. White pixels are written as 0. Black is 1 and white is 0, so black, white, white, white, black becomes 1 0 0 0 1. The wrong answer has the colours swapped. There are only two colours, so one bit (a 0 or a 1) is enough for each pixel.

Common mistakes: The key is back to front. In this code 1 stands for a black pixel and 0 stands for a white pixel, so it should say: Key: 1 = black, 0 = white. Each row of a 5 by 5 picture needs 5 bits, one for each pixel. This row has only 4 bits. It should be: Row 3: 1 0 0 0 0.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 44–57) and word search (Modules 44–71).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Our key says 1 = black and 0 = white. How do we write a black pixel?
01
Matches
A row of 5 white pixels is written 11111
↓
White pixels should be 0, not 1. In the key, 1 means black, so 11111 is a row of black pixels.
Applying
Meanings
Term
1 = black, 0 = white
Meaning
To encode a black-and-white picture, write 1 for each black pixel and 0 for each white pixel. Work row by row, one bit per pixel.
Practice
11111
Testing
Gaps
Row 1 code:
Check Answer
Spots
1Key: 1 = white, 0 = black
2Row 1: 1 1 1 1 1

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Kangaroo Rat' badge — Speed Typer, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Our key says 1 = black and 0 = white. How do we write a black pixel?
A. 1 ✓
B. 0
With the key 1 = black, every black pixel is written as a 1. White pixels are written as 0.
2. A row has 5 pixels: black, white, white, white, black. Which code is right?
A. 10001 ✓
B. 01110
Black is 1 and white is 0, so black, white, white, white, black becomes 1 0 0 0 1. The wrong answer has the colours swapped.
3. A row of 5 white pixels is encoded as...
A. 00000 ✓
B. 11111
White pixels are 0, so five white pixels make 00000. 11111 would be a row of five black pixels.
4. How many bits does each pixel need in a black-and-white picture?
A. Five bits per pixel
B. One bit per pixel ✓
There are only two colours, so one bit (a 0 or a 1) is enough for each pixel.
5. A 5 by 5 black-and-white picture has 5 rows of 5 pixels. How many bits are needed in total?
A. 5 bits
B. 25 bits ✓
5 rows with 5 pixels each is 25 pixels. With one bit per pixel, that is 25 bits.

Match the Pairs

01110 → One row of a 5 pixel wide picture: white, black, black, black, white
11111 → A row where all 5 pixels are black
A key for a black-and-white picture says black is 1 and white is 0 → 1 = black, 0 = white
A 5 by 5 picture is written one row at a time, so it takes 5 rows of 5 digits → 00100 01100 00100 00100 01110
A row of 5 white pixels is written 11111 → White pixels should be 0, not 1. In the key, 1 means black, so 11111 is a row of black pixels.
A row with black, white, white, white, black is written 1001 → There are only 4 digits but the row has 5 pixels. One digit is missing, so the row should be 10001.

Key Term

1 = black, 0 = white
To encode a black-and-white picture, write 1 for each black pixel and 0 for each white pixel. Work row by row, one bit per pixel.

Fill in the Blanks

1. Key: 1 = black, 0 = white Row 1 pixels: B W W W B Row 1 code: 10001
Hint: Type the five bits for this row, using the key to turn each pixel into a digit.
2. Key: 1 = black, 0 = white Row 2 pixels: B W B W B Row 2 code: 1 0 1 0 1
Hint: Type the one bit for the middle pixel, using the key.
3. Key: 1 = black, 0 = white Letter T, row 1 is all black: 5 pixels Row 1 code: 11111
Hint: Type the row of bits when every pixel is the same colour.
4. Grid: 5 by 5, one bit per pixel Bits in the whole grid: 25
Hint: Type how many bits are needed for all the rows. Think rows times pixels in each row.
5. Key: 1 = black, 0 = white Letter O, row 1 pixels: W B B B W Row 1 code: 01110
Hint: Type the bits for this row, going from left to right and starting with the white pixel.

Spot the Error

Question 1
A Key: 1 = white, 0 = black
B Row 1: 1 1 1 1 1
C Row 2: 0 0 1 0 0
D Row 3: 0 0 1 0 0
Line A — The key is back to front. In this code 1 stands for a black pixel and 0 stands for a white pixel, so it should say: Key: 1 = black, 0 = white.
Question 2
A Picture: letter L, 5 by 5
B Row 1: 1 0 0 0 0
C Row 2: 1 0 0 0 0
D Row 3: 1 0 0 0
E Row 4: 1 0 0 0 0
F Row 5: 1 1 1 1 1
Line D — Each row of a 5 by 5 picture needs 5 bits, one for each pixel. This row has only 4 bits. It should be: Row 3: 1 0 0 0 0.
Question 3
A Key: 1 = black, 0 = white
B Row 1: 0 1 0 1 2
C Row 2: 0 0 0 0 0
D Row 3: 1 0 0 0 1
E Row 4: 0 1 1 1 0
Line B — A black-and-white picture only uses the bits 0 and 1. The digit 2 is not allowed. The row should be: Row 1: 0 1 0 1 0.
Question 4
A Black = 1, White = 0
B B W W W B -> 1 0 0 0 1
C W B B B W -> 1 0 0 0 1
D B W W W B -> 1 0 0 0 1
Line C — The 0s and 1s are swapped. White pixels are 0 and black pixels are 1, so W B B B W must be written 0 1 1 1 0.
Question 5
A Key: 1 = black, 0 = white
B Row 1: 0 0 1 0 0
C Row 2: 0 1 1 0 0
D Row 3: 0 0 1 0 0 0
E Row 4: 0 0 1 0 0
F Row 5: 0 1 1 1 0
Line D — This row has 6 bits, but the grid is only 5 pixels wide. There must be one bit per pixel, so it should be: Row 3: 0 0 1 0 0.

Student with a class code? Join your class →