ImageMagick

Steinberg-Floyd Dithering with ImageMagick

shell
convert input.gif -dither Steinberg -colors 4 -layers Optimize output.gif