danielepiccone / ditherjs

A javascript library which dithers an <img> using a fixed palette
http://danielepiccone.github.io/ditherjs/
133 stars 21 forks source link

Error in atkinson dithering #3

Closed AljoschaMeyer closed 8 years ago

AljoschaMeyer commented 8 years ago

Unless I'm misunderstanding the code, the error diffusion always adds the error of the red channel, even to the green and blue one.

robisodd commented 8 years ago

Yep, I noticed that on atkinsonDither(), too. All the "q[r]" from lines 162-174 should be "q[g]" and "q[b]", respectively. Modified it on mine and it looks much better.

danielepiccone commented 8 years ago

Thanks for catching this! I have fixed it with https://github.com/dpiccone/ditherjs/commit/63a19cdf5319b0d3bbf9a9644631aec605d1e9cd