pnmremap

Replace the colors in a PNM image. More information: <https://netpbm.sourceforge.net/doc/pnmremap.html>.

Install

All systems
curl cmd.cat/pnmremap.sh
Debian Debian
apt-get install netpbm
Ubuntu
apt-get install netpbm
Arch Arch Linux
pacman -S netpbm
image/svg+xml Kali Linux
apt-get install netpbm
CentOS
yum install netpbm-progs
Fedora
dnf install netpbm-progs
Windows (WSL2)
sudo apt-get update sudo apt-get install netpbm
OS X
brew install netpbm
Raspbian
apt-get install netpbm

Replace the colors in a PNM image. More information: <https://netpbm.sourceforge.net/doc/pnmremap.html>.

  • Replace the colors in an image with those in the specified color palette:
    pnmremap -mapfile path/to/palette_file.ppm path/to/input.pnm > path/to/output.pnm
  • Use Floyd-Steinberg dithering for representing colors missing in the color palette:
    pnmremap -mapfile path/to/palette_file.ppm -floyd path/to/input.pnm > path/to/output.pnm
  • Use the first color in the palette for representing colors missing in the color palette:
    pnmremap -mapfile path/to/palette_file.ppm -firstisdefault path/to/input.pnm > path/to/output.pnm
  • Use the specified color for representing colors missing in the color palette:
    pnmremap -mapfile path/to/palette_file.ppm -missingcolor color path/to/input.pnm > path/to/output.pnm

© tl;dr; authors and contributors