pgmtoppm

Colorize a PGM image. More information: https://netpbm.sourceforge.net/doc/pgmtoppm.html.

pgmtoppm -black red --white blue path/to/input.pgm > path/to/output.ppm

pgmtoppm -map path/to/colormap.ppm path/to/input.pgm > path/to/output.ppm