ppmnorm
Normalize PPM image color range
TLDR
View documentation for the current command
SYNOPSIS
ppmnorm [-b | -s | -g] [-l minval] [-u maxval] [-S samples] [ppmfile]
PARAMETERS
-b
Normalizes brightness and contrast to use the full intensity range from 0 to the maximum possible value for the image format. This is the default behavior if no option is specified.
-s
A historical synonym for -b. It performs the same brightness and contrast normalization.
-g
Applies gamma correction. This stretches the intensity range non-linearly, which can be useful for correcting images taken in low light or with specific camera characteristics. It aims to make the image appear more visually balanced.
-l minval
Specifies the input intensity value that should be mapped to black (0) in the output. Any input values below this will also become black.
-u maxval
Specifies the input intensity value that should be mapped to white (the maximum possible intensity value for the image format) in the output. Any input values above this will also become white.
-S samples
Calculates the normalization parameters (minimum and maximum input values) based on a random sample of samples pixels from the image instead of the entire image. This can speed up processing for very large images, though it might be less precise.
ppmfile
Path to the input PPM image file. If omitted, ppmnorm reads the PPM image data from standard input (stdin).
DESCRIPTION
ppmnorm adjusts the brightness and contrast of a PPM (Portable Pixmap) image to utilize the full range of colors available in the image format. It aims to make the darkest point black and the brightest point white, distributing the intermediate colors evenly. This process can significantly improve the visual appearance of images that might otherwise look washed out, too dark, or too bright. It reads a PPM image from standard input and writes the normalized PPM image to standard output. As part of the Netpbm tools suite, ppmnorm provides a fundamental image manipulation filter for converting and enhancing various image formats by leveraging simple, pipeline-friendly operations.
CAVEATS
ppmnorm works exclusively with PPM (Portable Pixmap) image files. It is not designed for other image formats like PNG, JPEG, or GIF directly. While effective for general brightness/contrast normalization, it may sometimes over-saturate images with very few distinct colors or extreme outlier pixel values. Repeated application without careful consideration can lead to loss of detail or unintended color shifts.
HISTORY
ppmnorm is a component of the Netpbm project, a comprehensive suite of graphics filters for converting and manipulating images. Netpbm originated from the earlier Pbmmake, Pgmtools, and Ppmtools packages in the early days of Unix. Its development has focused on creating simple, efficient utilities that adhere to the Unix philosophy of small, specialized tools that can be chained together via pipes for complex image processing tasks. ppmnorm specifically addresses the fundamental need for adjusting image tonal range.