How can a game store a tiny picture using only zeros and ones?
A game shows you a tiny badge. Zoom in and its smooth-looking edges turn into coloured squares. The game stores those colours using zeros and ones. How many bits does it need for the whole badge?
You used a code table to look up which bit pattern represents a character. The same idea works for colours. If you know the colour table, you can look up the colour a bit pattern stands for.
Look at the badge close up. Count four squares across and three squares down. Each square is one picture element, or pixel. We write the width first and the height second, so this is a four by three bitmap with twelve pixels.
You see another badge with five pixels across each row and two rows from top to bottom. Which option gives its width by height and its total number of pixels? Pick one.
Read down the badge's colour table. Zero zero is blue, zero one is yellow, one zero is red, and one one is green. Each code is two bits long. That makes the colour depth two bits per pixel, with four possible colours.
Read left to right, starting at the top. Blue, blue, yellow, yellow gives zero zero, zero zero, zero one, zero one. To decode the middle row, read pairs: zero zero, one zero, one zero, zero one gives blue, red, red, yellow. The bottom row has four green pixels, so repeat one one four times.
Multiply four across by three down to get twelve pixels. Each pixel needs two bits, so twelve times two gives twenty-four bits. Divide by eight because there are eight bits in a byte. That's three bytes for the pixel data alone.
A new badge is four pixels wide and four pixels high. It still uses two bits per pixel. Calculate the size of its pixel data in bits and in bytes, then pick the matching pair.
It's easy to read two bits per pixel as two colours. But the table showed four different codes, so you can choose from four colours. The badge still has twelve pixels. Those are three different counts: bits in a code, possible colours and squares in the grid.
In an exam, explain what changes and why. Increase either dimension alone and you store more pixels. Increase colour depth alone and each pixel takes more bits. Both changes increase the size of the uncompressed pixel data. The whole file can also contain extra information, such as a header.