PPMHIST(1)
π ppmhist β the manual, but make it cute π
okay bestie, welcome to the Ppmhist User Manual, straight out of the General Commands Manual section π this one's a little classic and honestly? it ate.
β¨ NAME β¨
ppmhist β print a histogram of the colors in a PPM image π
πΈ SYNOPSIS πΈ
ppmhist [-map | -nomap] [-hexcolor | -float | -colorname] [-noheader]
[-sort={frequency,rgb}] [-forensic] [ppmfile]
π¦ DESCRIPTION π¦
so this program is part of Netpbm(1) π (you know, the family).
ppmhist reads a PPM image as input and generates a histogram of the colors in the image β which is just a fancy way of saying it gives you a list of all the colors plus how many pixels of each color are in the image. literally a color census. iconic behavior.
π Output Format π
the output comes in one of two basic formats:
- a report for humans π«Ά
- a PPM image for use by programs π
and honestly the PPM image one is actually quite readable by humans too. main character energy from a file format, we love to see it.
π§ Human Report π§
you get this format by specifying β or just defaulting to β the -nomap option.
the format is one line for each color in the input image.
by default, there are two lines of column header and a summary at the top. use the -noheader option to suppress those lines. no header, no problem π
the summary tells you whether black or white are present, and how many shades of gray and color are present. the summary was new in Netpbm 10.82 (March 2018). so if you're on something ancient, that's why the vibe is off π«
in each line, ppmhist identifies the color by red, green, and blue components. by default it lists each of these in decimal, using the exact values that are in the PPM input. so if the image has a maxval of 255, the numbers in the listing range from 0 to 255. with the -hexcolor option you can change these numbers to hexadecimal π. with the -float option, the numbers are fractional, adjusted to a maxval of 1.
each line also lists the luminosity of the color. it's in decimal, on the same scale as the rgb values (see above, bestie π).
and each line lists the number of pixels in the image that have the color. in decimal. slay.
π¨ PPM Output π¨
you get this format with the -map option.
the output file is a genuine PPM image, but it's PPM Plain format and contains comments so that it is not a lot different from the human report described above β¨
as a PPM image, it can be useful as input to other programs that need some kind of palette. the image is a single row with one column for each distinct color in the image.
the function of PPM output is essentially the same as the output of pnmcolormap all. ppmhist is much older than pnmcolormap β it's giving elder statesman, it's giving og π
π OPTIONS π
in addition to the options common to all programs based on libnetpbm (most notably -quiet, see Common Options), ppmhist recognizes the following command line options:
-sort={frequency,rgb}β the-sortoption determines the order in which the colors are listed in the output.rgbmeans to sort them first by the intensity of the red component of the color, then of the green, then of the blue, with the least intense first.frequencymeans to list them in order of how many pixels in the input image have the color, with the most represented colors first. among colors with the same frequency, the order is the same as withrgb. the default isfrequency. π
heads up: before Netpbm 10.88 (September 2019), with -sort=frequency, the order of colors that have the same frequency is arbitrary π
-hexcolorβ print the color components in hexadecimal. see output format. you may not specify this option along with-floatormapπ«-floatβ print the color components and the luminosity as floating point numbers in the range [0,1]. see output format. you may not specify this option along with-hexcolorormapπ«
this option was added in Netpbm 10.19 (November 2003) π°οΈ
-mapβ generates a PPM file of the colormap for the image, with the color histogram as comments. see output format. you may not specify this option along with-floatorhexcolorπ«-nomapβ generates the histogram for human reading. this is the default π«Ά-colornameβ add the color name to the output. this is the name from the system color dictionary. if the exact color is not in the color dictionary, it is an asterisk followed by the name of the closest color that is in the dictionary. if you don't have a system color dictionary, the program fails π
this option was added in Netpbm 10.10 (October 2002) π°οΈ
-noheaderβ do not print the column headings. simple as that π-forensicβ with this option,ppmhistworks on images that contain invalid sample values. normally, like most Netpbm programs,ppmhistfails if it encounters a sample value greater than the maxval that the image declares. the presence of such a value means the image is invalid, so the pixels have no meaning. but with-forensic,ppmhistproduces a histogram of the actual sample values without regard to maxval. it issues messages summarizing the invalid pixels if there are any. π
one use for this is to diagnose the problem that caused the invalid Netpbm image to exist. detective mode, honestly π
there is a small exception to the ability of ppmhist to process invalid pixels even with -forensic: it can never process a sample value greater than 65535. note that in the rarely used Plain PPM format, it is possible for a number greater than that to appear where a sample value belongs. π
this option was new in Netpbm 10.66 (March 2014). but Netpbm older than 10.66 does not properly reject invalid sample values, so the effect is very similar to -forensic π
π SEE ALSO π
ppm(1), pgmhist(1), pnmcolormap(1), pnmhistmap(1), ppmchange(1)
π AUTHOR π
Copyright (C) 1989 by Jef Poskanzer.
π DOCUMENT SOURCE π
this manual page was generated by the Netpbm tool makeman from HTML source. the master documentation is at
http://netpbm.sourceforge.net/doc/ppmhist.html
okay that's the whole thing bestie, you're fully briefed, go make some histograms πβ¨ the source is netpbm documentation, dated 24 August 2019, and this whole page is the Ppmhist User Manual(1) β periodt π«Άπ
π¦ where this page comes from
- debian trixie: netpbm 2:11.10.02-1 Β· MIT
- ubuntu resolute: netpbm 2:11.10.02-1build1 Β· MIT
- ubuntu stonking: netpbm 2:11.13.03+ds-2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms