LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

pgmnorm

Normalize the contrast in a Netpbm image

TLDR

Normalize image contrast
$ pgmnorm [input.pgm] > [output.pgm]
copy
Normalize with custom percentile cutoffs
$ pgmnorm -bpercent [2] -wpercent [1] [input.pgm] > [output.pgm]
copy
Specify exact pixel values for black and white mapping
$ pgmnorm -bvalue [30] -wvalue [220] [input.pgm] > [output.pgm]
copy
Normalize while preserving hues in color images
$ pgmnorm -keephues [input.ppm] > [output.ppm]
copy

SYNOPSIS

pgmnorm [options] [file]

DESCRIPTION

pgmnorm reads a PNM image (PBM, PGM, or PPM), normalizes the contrast by forcing the darkest pixels to black and the lightest pixels to white, and linearly rescales the values in between. It outputs the same kind of image. This is an older name for pnmnorm.By default, the darkest 2 percent of pixels are mapped to black and the lightest 1 percent to white. These thresholds can be changed with -bpercent and -wpercent, or exact cutoff values can be specified with -bvalue and -wvalue. If both percentage and value options are given for the same end, the one producing the least change is used.Part of the Netpbm toolkit.

PARAMETERS

-bpercent n

Percentage of darkest pixels to map to black. Default: 2.
-wpercent n
Percentage of lightest pixels to map to white. Default: 1.
-bvalue n
Exact pixel value to map to black (overrides -bpercent if it produces less change).
-wvalue n
Exact pixel value to map to white (overrides -wpercent if it produces less change).
-keephues
Keep each pixel the same hue; only adjust brightness. Without this, components are normalized independently, which may shift hues.
-brightmax
Use the most intense RGB component as the pixel's brightness instead of luminosity.

SEE ALSO

Copied to clipboard
Kai