In my last post I talked about ordered dithering, and how it compared to the error diffusion technique I had implemented previously. After successfully implementing ordered dithering the natural next step was to incorporate the ordered dithering into my BBC Micro Mode 2 image filter so that all the image processing techniques were available in one filter.
Finished filter interface
Whilst doing this, I also made the Strength slider in my BBC Micro filter act upon Ordered Dithering as well as Error Diffusion. This allows for some quite interesting effects.
Here is John Liven's Somerset cottage picture. I've applied Ordered Dithering with a 2x2 threshold matrix set to 100% strength:
Mode 2, 2x2 Ordered Dither, 100% Strength
And here is the same picture with the same dithering applied at just 50% strength:
Mode 2, 2x2 Ordered Dither, 50% Strength
Once this was done the BBC Micro Mode 2 filter was finally finished off. I then turned my attention to writing a BBC Micro Mode 5 filter. Mode 5 is very similar to Mode 2, but you can only use 4 colours from a selection of 8.
This means the image filter needs an additional step in which the palette to use for the image is selected. The way I approached this was to scan the entire image pixel by pixel tallying which of the 8 possible BBC Micro colours each pixel was closest to. Then, I simply used the four most commonly found colours.
Incidentally, the way you work out how close one colour is to another is quite simple once it's explained to you: I found the answer here.
After a coding a bit of Python I loaded an image of some parrots into The GIMP:
Norwegian Blue is on the left
And tried out the filter with no dithering. It worked first time:
Mode 5, No Dithering
And when some Sierra3 error diffusion was added too, the results were incredibly good:
Mode 5, Sierra 3 Error Diffusion 100% Serpentine
I still can't get over the fact that there are just four colours (black, white, red and green) in this image.
With a Mode 5 filter under my belt it was very easy to produce a Mode 1 filter. Mode 1 is the same as Mode 5, but has square pixels:
Mode 1, Sierra 3 Error Diffusion 100% Serpentine
And a Mode 4 filter. Mode 4 is like Mode 1, but is restricted to just two colours:
Mode 4, Sierra 3 Error Diffusion 100% Serpentine
So, I have got a pretty nice suite of BBC Micro image filters, with only Mode 0 to add. As always, you can download them from here. Microsoft Windows users can find out how to install and use the filters with The GIMP by following the very nice set of instructions with pictures I've found here.