Getting the compression ratio

50 Views Asked by At

Given a picture of $200x200$ pixels. Without compression, each pixel uses $10$ bits to represent a color.

This image is compressed lossless by giving the colors a new coding. The coding of these colors is as small as possible, and all colors get the same bit length in this coding.

Suppose you know that a picture always consists of a maximum of $four$ colors (purple, orange, lightgreen, blue), what is the compression ratio?

I happen to know that answer to this question is $20\%$. But I'm not sure how to get this myself. Can someone explain to me how I can get the compression ratio here?

1

There are 1 best solutions below

6
On BEST ANSWER

Consider how many bits you need per pixel after compression (taking into account that each pixel can only have one of four colours), compared to the ten you needed before. That's your answer.