PNMQUANT(1)
π PNMQUANT π
ok so this is the manual for pnmquant, part of the Netpbm user manual family. welcome bestie, grab a strawberry π
β¨ NAME β¨
pnmquant β quantize the colors in a Netpbm image to a smaller set π¨
β¨ SYNOPSIS β¨
pnmquant [-center|-meancolor|-meanpixel] [-floyd|-fs] [-nofloyd|-nofs]
[-spreadbrightness|-spreadluminosity] {[-norandom]|[-randomseed=n]}
ncolors [pnmfile]
ok some ground rules for the args, no cap:
- every option can be abbreviated down to its shortest unique prefix (slay, efficiency π )
- you can use two hyphens instead of one to designate an option, both hit
- and you can put either white space or equals signs between an option name and its value. your choice, main character energy
β¨ DESCRIPTION β¨
This program is part of Netpbm(1).
pnmquant reads a PNM image as input. It chooses ncolors colors that best represent the image, maps the existing colors over to those new ones, and writes a PNM image as output. it's giving glow-up β¨
Lowkey the whole tea is this: this program is simply a combination of pnmcolormap and pnmremap, where the colors of the input get remapped using a color map that's generated from the colors in that same input. The options mean the exact same thing as in those programs. So if you wanna actually understand pnmquant, go read their documentation. iykyk π«Ά
β οΈ heads up: you may actually get fewer than ncolors colors in the output!
why tho? because the method pnmcolormap uses to choose the best set of colors for the image is not the same as the method pnmremap uses to determine the best color from the set to represent an individual color. For example, pnmcolormap may include salmon in the color map as the best representative of a pink pixel in the input, and include coral in the color map as the best representative of an actual coral pixel in the input. But pnmremap is free to use any color in the color map to represent that pink pixel, and it would find coral is a closer match for pink than salmon, and therefore use coral for pink. Which means pnmremap might not use salmon for any pixel. rip salmon π£π
This waste of a slot in the color map is a consequence of the approximate method pnmcolormap uses in order to compute the color map with a practical amount of computation. it's a tradeoff bestie, not a bug π
π Running pnmcolormap and pnmremap Separately π
It is much faster to call pnmcolormap and pnmremap directly than to run pnmquant. You save the overhead of the Perl interpreter and creating two extra processes. pnmquant is just a convenience. convenient queen but still π
Here is an example of the relationship between the programs:
This:
$ pnmquant 256 myimage.pnm >/tmp/colormap.pnm >myimage256.pnm
does essentially this:
$ pnmcolormap 256 myimage.pnm >/tmp/colormap.pnm
$ pnmremap -mapfile=/tmp/colormap.pnm myimage.pnm >myimage256.pnm
β¨ OPTIONS β¨
In addition to the options common to all programs based on libnetpbm (most notably -quiet, see Common Options), pnmquant recognizes the following command line options:
π Options Passed to pnmcolormap π
These options control the selection of the palette. They are options to pnmcolormap(1).
-centerβ palette selection option, passed straight through topnmcolormap(1)-meancolorβ palette selection option, passed straight through topnmcolormap(1)-meanpixelβ palette selection option, passed straight through topnmcolormap(1)-spreadbrightnessβ palette selection option, passed straight through topnmcolormap(1)-spreadluminosityβ palette selection option, passed straight through topnmcolormap(1)
π¦ Options Passed to pnmremap π¦
These options control which color from the palette the program uses to replace a pixel of a certain color from the input. They are options to pnmremap(1).
-floydβ remap option, passed straight through topnmremap(1)-fsβ remap option, passed straight through topnmremap(1)-nofloydβ remap option, passed straight through topnmremap(1)-nofsβ remap option, passed straight through topnmremap(1)-norandomβ remap option, passed straight through topnmremap(1)-randomseedβ remap option, passed straight through topnmremap(1)-norandomβ remap option, passed straight through topnmremap(1)
ngl it does list -norandom twice in that second group. i'm just the messenger, not the editor π
β¨ HISTORY β¨
pnmquantdid not exist before Netpbm 9.21 (January 2001). Before that,ppmquantdid the same thing, but only on PPM images.ppmquantcontinues to exist, but is only a front end (for name compatibility) topnmquant. legacy icon behavior π«Ά-versiondid not exist before Netpbm 10.75 (June 2016).-norandomdid not exist before Netpbm 10.82 (March 2018).
β¨ SEE ALSO β¨
pnmcolormap(1), pnmremap(1), pnmquantall(1), pamdepth(1), ppmdither(1), ppmquant(1), pnm(1)
β¨ 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/pnmquant.html
ok that's the whole thing bestie, you ate π β¨ this was netpbm documentation, dated 09 February 2019, and it's the Pnmquant User Manual β periodt ππ¦π
π¦ where this page comes from
- debian trixie: netpbm 2:11.10.02-1 Β· MIT
- ubuntu noble: netpbm 2:11.05.02-1.1build1 Β· 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