pnmhistmap

Draw a histogram of a PNM image. More information: https://netpbm.sourceforge.net/doc/pnmhistmap.html.

pnmhistmap path/to/input.pnm > path/to/output.pnm

pnmhistmap -dots path/to/input.pnm > path/to/output.pnm

pnmhistmap -lval minval -rval maxval path/to/input.pnm > path/to/output.pnm