Trying to implement this in python grasshopper but it doesn’t seem to look like the examples in the web
My guess its the way python modify the list during the for loop doesnt allow it to accumulate the error correctly any help ?
A few weeks ago, Daniel Shiffman published a Coding Challenge video, about Floyd-Steinberg dithering, on his YouTube channel. He explains rather well and in detail how the algorithm works and implements it in Processing (Java-based programming language).
I find his videos rather easy to follow. You could try to port his approach to GH or rhinopython. I did this with a number of Coding Challenges myself! Usually the most difficult part, besides the main algorithm, is coming up with the “animation” part, which is pretty straight forward in Processing.
So this isn’t really helpful, sorry in advance, but I’ve coded up some dithering algorithms for GH2 image processing. Here’s a few of the test results:
Atkinson with 6 colours. If I recall correctly Atkinson error diffusion doesn’t diffuse 100% of the error, resulting in an image with more residual error but fewer dithered regions:
Today, I had some time to attempt my own Floyd-Steinberg dithering algorithm in GHPython.
It opens an image from a provided path, performs the dithering and outputs points and colors for visualisation purposes. It’s by no means perfect, but it works!