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.
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.
There are other approaches, such as Ordered Dithering with a Bayer Matrix.
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
Have a good challenge idea? Consider submitting it to /r/dailyprogrammer_ideas Thanks to /u/skeeto for this challenge idea