pgmhist
Print a histogram of the values present in a PGM image. tldr-pages
On several platforms
Several platforms
Display the histogram for human reading
pgmhist path/to/image.pgmIdentifyDisplay the median grey value
pgmhist -median path/to/image.pgmIdentifyDisplay the four quartile grey values
pgmhist -quartile path/to/image.pgmIdentifyReport the existence of invalid grey values
pgmhist -forensic path/to/image.pgmIdentifyDisplay machine-readable output
pgmhist -machine path/to/image.pgmIdentify