LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

ppmquant

Reduce PPM image color count

TLDR

Reduce to N colors
$ ppmquant [256] [input.ppm] > [output.ppm]
copy
Reduce to 16 colors
$ ppmquant [16] [input.ppm] > [output.ppm]
copy
With Floyd-Steinberg dithering
$ ppmquant -fs [256] [input.ppm] > [output.ppm]
copy
Use existing colormap
$ ppmquant -map [palette.ppm] [input.ppm] > [output.ppm]
copy

SYNOPSIS

ppmquant [options] ncolors [ppmfile]

DESCRIPTION

ppmquant reduces the number of colors in a PPM image using median-cut quantization. Essential for creating GIF images or reducing file size.Superseded by pnmquant in modern Netpbm.

PARAMETERS

ncolors

Maximum number of colors.
-fs
Floyd-Steinberg dithering.
-map file
Use colormap from file.
-spreadbrightness
Spread by brightness.
-spreadluminosity
Spread by luminosity.

EXAMPLES

$ # Reduce to 256 colors
ppmquant 256 photo.ppm > reduced.ppm

# 16 colors with dithering
ppmquant -fs 16 image.ppm > dithered.ppm

# Use web-safe palette
ppmquant -map websafe.ppm image.ppm > websafe.ppm

# Convert for GIF
ppmquant 256 image.ppm | ppmtogif > image.gif
copy

INSTALL

sudo apt install netpbm
copy
sudo dnf install netpbm
copy
sudo pacman -S netpbm
copy
sudo apk add netpbm-extras
copy
sudo zypper install netpbm
copy
brew install netpbm
copy
nix profile install nixpkgs#netpbm
copy

CAVEATS

Use pnmquant for new work. Dithering can increase file size. Part of Netpbm.

HISTORY

ppmquant is part of Netpbm by Jef Poskanzer, implementing the median-cut color quantization algorithm by Paul Heckbert.

SEE ALSO

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid