douglas adams times 4

I'm trying to understand the various techniques people have come up with to represent images with simple building blocks.

Background

For the pixel portraits, we reduced the number of possible colours of an image and split them into "large pixels" to be painted or stickered at community art events. See Barrow or Kendal projects for context.

I've read that using something called "Dithering " you can create images using just 2 colours. Using just two colours could be great for pixel portraits as it'll cut down on cost and complexity.

I'm attempting to explain dithering here as an attempt to understand it!

Why Dither

I'll explain using the medium of Douglas Adams.

You can see what's going on with pixels if we zoom in on a bit.

1: Colour

Computers images are made up from square pixels each about a quarter of a millimeter.

The colour for each pixels is set using a mix of Red, Green and Blue. Using different quantities of each you can get 16.7 million colours. A zero value of each gives you black, a maximum value for each gives you white.

The maximum values for red, green or blue is 256 (so 256 x 256 x 256 = 16,777,216 colour variations are possible).

2: Brightness

If you restrict each pixel just to show its brightness you get a greyscale image. To get a brightness (greyscale) image from a colour image all you need get an average of all the colours.

(Red + Green + Blue) ÷ 3 = Brightness

For example if a colour pixel has 240 for red, 190 for green and 40 for blue its brightness is the average of

(240 + 160 + 20) ÷ 3 = 140

r = 240, g = 160, b = 140 (orange)

r = 160, g = 20, b = 240 (purple)

r = 20, g = 140, b = 240

...

notes to explain:

add about quantisation errors and different weightings used by Floyd-Steinberg etc to dither.