Light dithering

As I’m mostly working on back-end and pipelines those days, I don’t do much user facing code. To compensate a bit I have been playing around with Javascript and Html5. While I can’t say that Javascript is elegant, it is very easy to play around with, the modern equivalent of Basic, I suppose.

So I wrote a small dithering function, it uses a simpler error distribution matrix than Floyd–Steinberg as it only distributes the error on the pixels to the right and below the one considered. The algorithm also uses some randomisation to avoid patterns.

In order to respect traditions, this one dithers the classical Lenna image. Just click on the button to load the image and the button to dither the image.

Image: Lenna

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.