Quarry School

Decode a tiny bitmap

Subject: Computing
Level 1 · FoundationsAbout 4 min read13 new terms
How this was estimated

Programmatic estimate. Rung levels, worked steps, prerequisites, terms and sentence length contribute to this level. It describes the lesson, not your ability.

Reading counts the whole lesson, including folded explanations, at 180 words a minute. Practice allows two minutes per item. These are planning assumptions; take the time you need.

AI estimate unavailable.

Path to here

Open the unit’s lesson list to follow the lesson order.

    Quick review (2 minutes)

    In plain words

    Imagine leaving a note for a friend about two squares side by side on a calendar.

    Rule

    The paper format is the set of rules that tells you how to read the bits. It gives you the width, height, colour key and reading order. Both dimensions are whole numbers of at least one. Multiply the width by the height to count the squares. You need exactly that many bits, including every 0.

    For the two grids shown here, the key is 1 for ink and 0 for white paper. Start with an all-white grid and the first bit. Work across each row from left to right, starting with the top row. Stop when you use the last bit in the bottom-right square.

    Step

    1. Draw the given number of columns and rows. Leave all squares white. Count the squares and the bits. If the counts differ, stop before shading and report the two counts.

    2. Start at the top-left square with the first bit. Use the key to decide whether to shade the square or leave it white.

    3. Use the next bit in the next square to the right. At the end of a row, move to the leftmost square of the next row down if there is one. Stop after you use the last bit in the bottom-right square.

    4. Read the drawing back from the top left in the same order. Use the key to write one bit per square and join the rows into one line with no spaces.

    Trap

    Use the width to decide where to end each row. Grid A needs three bits across each of its two rows. If you use the height of two as the row length and lay out all six bits, the third bit starts a new row and you get Grid B. Check the key as well. If you swap what 0 and 1 mean, every ink square becomes white and every white square becomes ink.

    1 In plain words

    Imagine leaving a note for a friend about two squares side by side on a calendar. Agree that 1 means shade a square dark and 0 means leave it white. Read 10 from left to right. Shade the first square and leave the second white.

    A bit can have either of two values, written 0 or 1. Here, the bit stream is the line of bits you read in order.

    A picture can be made from a grid of coloured spots called pixels. In our paper bitmap, each pixel is one square with a colour set by one bit. To decode it, use the bits to draw the picture.

    A row goes across and a column runs down. Look up the width (how many columns), height (how many rows), and key (which bit means which colour). The width and height are the picture's dimensions. In this paper format, read in row-major order. Finish one row before you start the next.

    2 Picture it

    100110Grid AGrid B

    The three-column grid has rows 100 and 110. The two-column grid has rows 10, 01 and 10. Reading either grid row by row gives 100110.

    Six bits arranged into two shapes

    3 Why

    In this paper bitmap, each square has two possible colours, and a bit has two possible values. Give each colour its own value and one bit is enough to tell you how to colour a square.

    To get the bits back, follow the same path and use the key in reverse. When you see ink, write the bit that meant ink. When you see white, write the bit that meant white.

    4 The rule

    The paper format is the set of rules that tells you how to read the bits.

    It gives you the width, height, colour key and reading order. Both dimensions are whole numbers of at least one. Multiply the width by the height to count the squares. You need exactly that many bits, including every 0.

    For the two grids shown here, the key is 1 for ink and 0 for white paper. Start with an all-white grid and the first bit. Work across each row from left to right, starting with the top row. Stop when you use the last bit in the bottom-right square.

    5 How

    1. Draw the given number of columns and rows. Leave all squares white. Count the squares and the bits. If the counts differ, stop before shading and report the two counts.
    2. Start at the top-left square with the first bit. Use the key to decide whether to shade the square or leave it white.
    3. Use the next bit in the next square to the right. At the end of a row, move to the leftmost square of the next row down if there is one. Stop after you use the last bit in the bottom-right square.
    4. Read the drawing back from the top left in the same order. Use the key to write one bit per square and join the rows into one line with no spaces.

    6 Trace

    Read both layouts back
    ColumnsRows top to bottomRecovered bitsExplanation
    3100 / 110100110The fourth bit starts the second row.
    210 / 01 / 10100110Bits three and five start new rows.

    7 The trap

    Use the width to decide where to end each row. Grid A needs three bits across each of its two rows. If you use the height of two as the row length and lay out all six bits, the third bit starts a new row and you get Grid B. Check the key as well. If you swap what 0 and 1 mean, every ink square becomes white and every white square becomes ink.

    Quick checks

    Quick check 1 of 2

    Draw 01001110 with 4 columns and 2 rows, using 1 for ink and 0 for white paper. What are the bits in each row?

    Show the steps and the answer
    Answer

    0100 / 1110.

    Why: Put the first four bits on the top row and the next four below. The first 0 uses the first square, which stays white.

    Source: University of Canterbury Computer Science Education Research Group, Computer Science Field Guide: Images and Colours

    Quick check 2 of 2

    A two-column picture has these rows from top to bottom, each written left to right: white and ink, ink and white, ink and ink. This time the key is 0 for ink and 1 for white. What bit stream do you get?

    Show the steps and the answer
    Answer

    100100.

    Why: The rows read 10, 01 and 00 under this key. Join them in that order.

    Source: University of Canterbury Computer Science Education Research Group, Computer Science Field Guide: What's the big picture?

    Sources

    1. Computer Science Field Guide: What's the big picture?. University of Canterbury Computer Science Education Research Group. CC BY-SA 4.0. Read 25 Nov 2026.
    2. Computer Science Field Guide: Images and Colours. University of Canterbury Computer Science Education Research Group. CC BY-SA 4.0. Read 25 Nov 2026.