-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Hi, there are many dithering algorithms out there. A nice-to-have would be the Atkinson algorithm which was used on the 1-bit Macintosh computers. It would be a good match for 1-bit e-ink output selection.
function atkinson(pixels,w) {
const e=Array(2*w).fill(0), m=[0,1,w-2,w-1,w,2*w-1]
return pixels.map(x => {
const pix=x+(e.push(0),e.shift()), col=pix>.5, err=(pix-col)/8
m.forEach(x => e[x]+=err)
return col
})
}
Good article on B&W dithering with examples: https://surma.dev/things/ditherpunk/
Web component for html to do Atkinson which might work for you since cr2xt is using a web engine: https://github.com/andrewstephens75/as-dithered-image referred to in https://sheep.horse/2023/1/improved_web_component_for_pixel-accurate_atkinson.html
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request