anytopnm
Converts an arbitrary type of image file to common image formats.
TLDR
Convert an input image to PBM, PGM, or PPM format irrespective of the input type
$ anytopnm [path/to/input] > [path/to/output.pnm]
Display version
$ anytopnm -version
Convert an input image to PBM, PGM, or PPM format irrespective of the input type