Navigation: LaesieWorks Image Compression Homepage This page

Jump to:


Image Compression


In book printing, a photo with no color but many shades of gray, can be printed with just black ink on white paper. The halftone screen transformed the levels of gray into a uniform grid of dots. These dots have different sizes, and give, from enough distance, the illusion of grays.

Halftone screen

Dither is when a grayscale image is not transformed into dots of different sizes, but "frequency modulated", meaning that only the smallest possible dots are used. The more dots, the darker the area. This gives a better quality print relative to the good old halftone screen, but it is (was) harder to create and print.

Dither, black and white.

On a modern display we have a grid of digital pixels, and millions of colors possible per pixels (note: every pixel on the display is actually a group of 3 pixels: R, G and B). But for data compression, it's important to bring the amount of colors down to an acceptable minimum. One good way of doing that, is to use dither. Dither can create the illusion of tones. A mixture of black and white pixels gives the illusion of grays. But just black and white pixels doesn't give a high quality image, mainly because the pixels are quite big. Lucky it's possible to dither a photo with more than just black and white. Using for example: black, dark gray, light gray, and white, the result is much better. The more tones, the better. But also: the more tones, the more information, the bigger the file.

Dither, with 8 shades of gray.

How many shades of gray are enough to get a high image quality, hard to distinguish from the origin with 256 shades of gray?
I think 32. (efficient to choose a power of 2)

Dither, with 32 shades of gray.
And next; the original with possibly 256 shades of gray.
Can you spot the difference?

32 tones are enough when using gray, where the eyes are very sensitive for. For most colors, the eyes are less sensitive. For the yellow to white spectrum, 8 tones are enough.

The gray spectrum on the far left has only 32 tones in it, doesn't look smooth at all.

The right gray spectrum, has only 32 gray tones also, but now it seems smooth because it is dithered.

32 tones

32 tones


One grayscale pixels with 256 tones, costs 8 bits (2^8=256)
One grayscale pixels with 32 tones, costs 5 bits (2^5=32)
Thus this loss of image quality doesn't really give much compression: 5/8 = 0.62

More interesting is the reduction of combinations.
The amount of combinations is: the amount of tones to the power of the amount of pixels.
At 256 tones, the amount of combinations of a 8*8 image block is
(2^8)^(8*8) =

But at 32 tones, the amount of combinations of a 8*8 image block is only
(2^5)^(8*8) =

The ratio is
((2^5)^(8*8))/((2^8)^(8*8)) =
That is an incredible reduction of combinations!


Full grayscale: 256 tones of gray
(246 here, to be exact)

Only 32 tones of gray
Can you spot the difference?!

16 tones of gray...
It's visible

8 tones of gray
now it really shows

Giesbert Nijhuis

Back to top

Back to index