Computing · Make

Encode a tiny pixel picture

Can someone rebuild a small image from an unambiguous written code?

Decode an original four-by-four bitmap with a complete legend, then check how one changed bit alters the picture.

15–25 minutes, or one row for a first try. More time is optional.

A 4-by-4 bitmap with rows 1001, 0110, 0110, 1001 forms two dark diagonals. Changing the final bit makes the bottom-right cell white.
Original bitmap: a tiny diagonal pattern. Open full-size diagram ↗

Start here

Use a 4-by-4 grid and these rows from top to bottom: 1001, 0110, 0110, 1001. Read each row left to right; 1 is dark and 0 is white.

Use your idea or the example below. Talk, write, draw, point or listen first. You can stop after one step.

Try it your way.

  1. Keep the header with the data

    Write width 4 and height 4 beside the rows. Without a size and reading-order convention, a string of digits may be arranged in different ways.

  2. Decode the original

    Shade cells marked 1 and leave 0 white. The pattern has dark cells along both diagonals: eight dark and eight white cells.

  3. Check a round trip

    Read your shaded grid back into four digit rows. Compare every row with the supplied code rather than deciding only whether the picture looks familiar.

  4. Change one bit

    Make a separately labelled copy whose last row is 1000. The bottom-right cell becomes white; the other 15 cells stay the same. Keep the original for comparison.

One possible version

Original bitmap: a tiny diagonal pattern

Header: width 4, height 4; row order top to bottom; within each row left to right; 0 white, 1 dark.

  • Rows: 1001/0110/0110/1001. Each row contains four bits.
  • The original contains eight digits equal to 1, so it has eight dark cells.
  • Changing only the last digit produces 1000 in the last row and seven dark cells overall.

This is a monochrome encoding exercise, not every image format. A code needs its agreed dimensions and symbol meanings to be decoded correctly.

A different way.

Decode only the first row or point to the changed bottom-right cell. You can explain the supplied grid without drawing or installing anything.

If you want more.

Describe row 1001 as one dark cell, two white cells and one dark cell. Explain why counts without a starting colour would be ambiguous.

Something to keep?

Did my code preserve both the picture data and the rules for arranging it?

You can keep a question, a sketch or a change of mind. A finished product is optional.

This opens an editable starter in your project tools. It asks before replacing open work. Choosing it does not save or share your work automatically.