pnmnorm

Normalize contrast in PNM images

TLDR

Normalize image contrast
$ pnmnorm [input.pnm] > [output.pnm]
Specify brightness range
$ pnmnorm -bpercent [5] -wpercent [5] [input.pnm] > [output.pnm]
Preserve midpoint
$ pnmnorm -midvalue [127] [input.pnm] > [output.pnm]

SYNOPSIS

pnmnorm [options] [file]

DESCRIPTION

pnmnorm normalizes the contrast of PNM images by stretching the histogram to use the full dynamic range. It finds the darkest and brightest pixel values and linearly maps them to the minimum and maximum possible values.The -bpercent and -wpercent options control how aggressively the black and white points are clipped, ignoring a percentage of outlier pixels at each end. The -midvalue option preserves a specific middle gray value during the normalization. Part of the Netpbm toolkit.

PARAMETERS

FILE

Input PNM file.
-bpercent N
Black point percentage.
-wpercent N
White point percentage.
-bvalue N
Black cutoff value.
-wvalue N
White cutoff value.
-midvalue N
Middle gray value to preserve.

INSTALL

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

CAVEATS

May clip extreme values. Part of Netpbm suite.

HISTORY

pnmnorm was created as part of Netpbm for automatic contrast enhancement.

SEE ALSO

pnmhisteq(1), pnmgamma(1), ppmnorm(1)