Show HN: Ordered Error Diffusion Dithering
observablehq.com
observablehq.com
So part of the reason why I submitted this was that I hoped that it would result in some feedback from people saying "oh yeah, that's actually pretty standard stuff, Knuth mentions it on page X", but maybe the topic is a bit too niche even for HN.
In 1983, Billotet-Hoffman and Bryngdahl [11] suggested using an ordered dither threshold array in place of the fixed threshold used in error diffusion. However, the resulting halftoned output differs little from conventional ordered dither.
Later in the chapter they explore the idea of using a random threshold instead of an ordered pattern.
[11] Billotet-Hoffman, C. and O. Bryngdahl (1983) "On the error diffusion technique for electronic halftoning", Proc. SID, vol. 24, pp. 253-258
I disagree with their conclusions though, look at this crosshatching dither that emerges from totally different parents:
https://mobile.twitter.com/JobvdZwan/status/1201613029013671...
The two-bit version looks pretty neat with it's pseudo-crosshatching effect, no?
Although I have to add that I had to rework the error-diffusion implementation to minimize rounding error. Before I did that the results weren't so great. So if we make the relatvely safe assumption that they used a "classic" eight-bit in-place optimized implementation , it might be true that it did not produce good results. And I'm sure that in their day they did not have the computer resources to quickly experiment with different combinations of dithering and ordering like I did.
Anyway, thank you so much for taking the time to look this up!
In the linked notebook, I use a separate error array made out of Int32 values (which is probably overkill, Int16 would suffice) and postpone division until the last moment. It's a small detail but it makes a significant difference in the hybrid output.
> people saying "oh yeah, [...] Knuth mentions it on page X"
Though the following answers your question only in a literal sense, you might find it interesting to read Knuth's article "Fonts for Digital Halftones", originally published in TUGboat (the magazine of the TeX Users Group), Volume 8 (1987), No. 2: http://mirror.tug.org/TUGboat/tb08-2/tb18knut.pdf (Reprinted with revisions as Chapter 21 of Digital Typography.) Though it technically mentions "ordered dither" (on the first page), it uses it in a different sense/purpose (to get an initial patterns of dots that make up a "font" called "odith"). It does do error diffusion though (details are in appendix).
Ah, the next chapter of Digital Typography (Knuth's paper "Digital Halftones by Dot Diffusion") seems even more relevant. It mentions "It would be nice to have a solution that retains both the sharpness of the Floyd-Steinberg method [of error diffusion] and the parallelism of ordered dither" and does something that seems to combine the two. (DOI 10.1145/35039.35040)
Is that the same dot diffusion that is also mentioned here?
http://caca.zoy.org/study/part3.html
If I understand the description that page correctly, dot diffusion visits pixels in Bayer order (instead of from left to right, top to bottom), and propagates error to all surrounding pixels that have not been visited yet. So yes, that does combine ordered dithering with error diffusion, but in a very different fashion than I do. The output (at least on the page that I've linked) is very half-tone ish.
Could you implement it and compare? Also, on your original page, what do the three columns under each algorithm (e.g. the three images under "Floyd-Steinberg" in the "Quick Refresher" section) mean?
> Do not get fooled by Knuth’s apparent good results. They specifically target dot printers and do not give terribly good results on a computer screen.
But of course! Knuth, as is his wont, was obviously not targeting computer screens or even targeting dot printers in general but a specific (Imagen) printer that happened to be on the Stanford campus. :-)
My own interest in the subject has mostly been 1D signals which might also serve to explain my affection for that thesis... but it really is much easier to understand first in 1D.
Thanks again
It's supposed to show an interactive notebook with canvas-based images, describing how ordered dithering can be composed with error diffusion dithering to create a form of hybrid dithering that is somewhere in-between.
Look, it's a simple page with text and images describing what happens. There is a description of the algorithm.
But one of the neat things of this method is that you can combine any error diffusion method with any threshold map, so to illustrate the point I implemented the idea in an interactive page where you can combine 14 different error diffusion methods with 12 threshold maps and 3 input images, for a total of 504 possible combinations. My apologies for giving you easy tools to experiment.
Yes. Static websites work best.