ZX Spectrum

The ZX Spectrum has a fixed palette of 15 colors, 7 dark, 7 bright and black. But the screen is divided into cells which are 8 pixels wide and either 1, 2, 4 or eight pixels high. Each cell can only contain two colors, either two dark or two bright ones (black can be combined with either).

One simple (but slow) method to convert an image to meet those requirements is to individually convert each cell with every possible color combination (not that many), and choose the best result compared to the original. Doing this in pure Python takes about a minute. Rewriting the code in C brough the time down to a new seconds. This also... other dithering algorithms.

Camparison of algorithms

Above is the original image. Below are images as they would appear on a ZX Spectrum for the different tile height using different dithering methods (all using NILE).

1248
No dithering
Ordered 4x4 dithering
Ordered 8x8 dithering
Floyd-Steinberg dithering
Jarvis-Judice-Ninke dithering
Stucki dithering

The result doesn't look all too bad (I've seen worse created specifically for the Spectrum). But it can definitely be improved. Especially the minimum tileheight has room for improvment, it has potential to yield the best result, but actuially looks worst with the error diffusion algorithms. Carrying the error diffusion over between cells would probably help alot.

snisurset.netContact the author.