Find Related products on Amazon

Shop on Amazon

Dithering in Colour

Published on: 2025-06-16 02:28:09

After reading a post on the HN frontpage from amanvir.com about dithering, I decided to join in on the fun. Here’s my attempt at implementing Atkinson dithering with support for colour palettes and correct linearisation. Dithering into arbitrary palettes The linked post from Aman does an excellent job of explaining dithering into a black and white palette using Atkinson Dithering. I can also recommend surma.dev’s post, he explains more than just error diffusion (for example ordered dithering). However both of them convert their input images to grayscale before dithering. If the sum of the pixel and the accumulated error is lighter than the threshold, they pin it to pure white, otherwise to pure black: colour = 255 if colour >= 127 else 0 . But why restrict ourselves to monochromatic palettes? Instead of converting the image to grayscale before dithering, we could use any palette! To dither into “black and white”, we simply compared the scalar value of the pixel to a threshold. If ... Read full article.