Example 1 — Decode a 1-bit icon
Show the steps and the answer
Cut the bits into 5 rows of 5, since the image is 5 pixels wide.
The width tells you where each row of pixels ends.
Shade each 1: row 1 has its middle pixel black, row 2 the middle three, row 3 all five, row 4 the middle three, row 5 the middle one.
With 1 bit per pixel, each bit is one square: 1 for black, 0 for white.
Read the shape: the black part grows from 1 pixel to 5 and shrinks back to 1, a diamond.
Looking at the rows together turns the numbers back into a picture.
Count the storage: 5 × 5 = 25 pixels × 1 bit = 25 bits, which needs 4 whole bytes (32 bits).
Files are stored in whole bytes, and 3 bytes (24 bits) would be one bit short.
Answer: A black diamond on a white background; 25 bits, stored in 4 bytes.
Takeaway: The width tells you how to cut the bits into rows, and the bits per pixel tell you how many bits each square uses.