Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
after.png added image dithering (272 intermediate) Sep 29, 2017

Challenge #272 [Intermediate] Dither that image


Dithering is the intentional use of noise to reduce the error of compression. If you start with a color image and want to reduce it to two colors (black and white) the naive approach is to threshold the image. However, the results are usually terrible.

Color Solids

Thresholded Solids

One of the most popular dithering algorithms is Floyd-Steinberg. When a pixel is thresholded, the error (difference) between the original value and the converted value is carried forward into nearby pixels.

Floyd-Steinberg Solids

There are other approaches, such as Ordered Dithering with a Bayer Matrix.

Bayer solids


Your program will take a color or grayscale image as its input. You may choose your input method appropriate to your language of choice. If you want to do it yourself, I suggest picking a Netpbm format, which is easy to read.


Output a two-color (e.g. Black and White) dithered image in your choice of format. Again, I suggest picking a Netpbm format, which is easy to write. Notes

Here is a good resource for dithering algorithms.


Have a good challenge idea? Consider submitting it to /r/dailyprogrammer_ideas Thanks to /u/skeeto for this challenge idea

You can’t perform that action at this time.