Reduce the number of colors in an image by applying dithering. More information: https://netpbm.sourceforge.net/doc/ppmdither.html.
ppmdither path/to/image.ppm > path/to/file.ppm
ppmdither -red 2 -green 3 -blue 2 path/to/image.ppm > path/to/file.ppm
ppmdither -dim 2 path/to/image.ppm > path/to/file.ppm