LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

pnmdepth

Change color depth of PNM images

TLDR

Change image depth
$ pnmdepth [newdepth] [input.pnm] > [output.pnm]
copy
Reduce to 8-bit
$ pnmdepth 255 [input.pnm] > [output.pnm]
copy
Reduce to 4-bit
$ pnmdepth 15 [input.pnm] > [output.pnm]
copy

SYNOPSIS

pnmdepth newmaxval [file]

DESCRIPTION

pnmdepth changes the maximum sample value (color depth) of PNM images by proportionally rescaling all pixel values. For example, converting from maxval 65535 (16-bit) to 255 (8-bit) scales each sample value accordingly.This is useful for reducing file size by lowering bit depth or for ensuring compatibility with tools that expect specific depth values. Part of the Netpbm toolkit; superseded by pamdepth.

PARAMETERS

NEWMAXVAL

New maximum sample value (depth).
FILE
Input PNM file.

INSTALL

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

CAVEATS

Values are scaled proportionally. Part of Netpbm suite.

HISTORY

pnmdepth was created as part of Netpbm for image depth conversion.

SEE ALSO

pamdepth(1), pnm(5), ppmquant(1)

Copied to clipboard
Kai