How might we encode an image?
Here is a picture of a house like the ones you drew when you were very small and one binary code that could be used to represent it:
Color | Code | |
blue | 0000 | |
light green | 0001 | |
dark green | 0010 | |
yellow | 0011 | |
orange | 0100 | |
red | 0101 | |
purple | 0111 | |
light grey | 1000 | |
dark grey | 1001 | |
brown | 1010 | |
black | 1011 | |
white | 1100 |
This image has only 12 unique colors, so we could represent it using a 4-bit code. More than 16 colors would require more bits in our code, and with fewer colors, we could possibly get by with less.