Simple implementation of the Floyd-Steinberg dithering algorithm.
Usage: dither < input.ppm > output.ppm
dither only accepts PPM images (P3). It outputs in the same format.
You can easily convert images to PPM format for processing with ImageMagick:
$ convert in.png -compress none in.ppm
This also works for other formats, like jpeg.
I've had problems converting back to PNG from PPM with ImageMagick though. For
that, I recommend using ffmpeg:
$ ffmpeg -i out.ppm out.png
The program seems to be broken for many images, causing a segmentation fault.