ppmtopgm

Convert a PPM image to a PGM image. More information: https://netpbm.sourceforge.net/doc/ppmtopgm.html.

ppmtopgm path/to/file.ppm > path/to/file.pgm

ppmtopgm -version