LinuxCommandLibrary

pnmquant

Reduce color count in PNM images

TLDR

Reduce colors

$ pnmquant [256] [input.pnm] > [output.pnm]
copy
Use median-cut algorithm
$ pnmquant -center [16] [input.pnm] > [output.pnm]
copy
Spread error (dithering)
$ pnmquant -fs [256] [input.pnm] > [output.pnm]
copy

SYNOPSIS

pnmquant [options] ncolors [file]

DESCRIPTION

pnmquant reduces the number of colors in a PNM image to a specified count using the median-cut color quantization algorithm. This is useful for preparing images for formats with limited color palettes or for reducing file size.
The -fs option enables Floyd-Steinberg dithering to simulate more colors by distributing quantization error to neighboring pixels. The -mapfile option allows quantizing to a pre-defined color palette from another image. Part of the Netpbm toolkit; wrapper around pnmcolormap and pnmremap.

PARAMETERS

ncolors

Target number of colors.
-fs
Floyd-Steinberg dithering.
-center
Center box color selection.
-spreadbrightness
Spread brightness.
-mapfile file
Use colormap from file.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community