LinuxCommandLibrary

pambrighten

Adjust screen brightness via command line

TLDR

Increase the saturation of each pixel by the specified percentage

$ pambrighten [[-s|-saturation]] [value_percent] [path/to/image.pam] > [path/to/output.pam]
copy

Increase the value (from the HSV color space) of each pixel by the specified percentage
$ pambrighten [[-va|-value]] [value_percent] [path/to/image.pam] > [path/to/output.pam]
copy

SYNOPSIS

pambrighten [ -luminosity | -rgb | -value ] [ -percentage | -factor ] brightness_value [ netpbm_file ]

PARAMETERS

-luminosity
    Applies brightness adjustment based on the image's calculated luminosity, providing a more perceptually accurate adjustment.

-rgb
    Applies brightness adjustment by scaling the Red, Green, and Blue color components directly. This is the default mode.

-value
    Applies brightness adjustment based on the 'value' component of the HSV/HSL color model (i.e., the maximum of R, G, and B components).

-percentage
    Interprets the brightness_value as a percentage. For example, 200 means 200% brightness (2x original).

-factor
    Interprets the brightness_value as a direct multiplication factor. For example, 2.0 means 2 times the original brightness. This is the default mode.

brightness_value
    A floating-point number representing the factor or percentage by which to adjust the image brightness.

netpbm_file
    The path to the input Netpbm image file. If omitted, pambrighten reads image data from standard input.

DESCRIPTION

pambrighten is a command-line utility from the Netpbm suite used to adjust the brightness of various Netpbm image formats (PAM, PBM, PGM, PPM). It processes an input image, applying a specified brightness factor, and outputs the modified image. The adjustment factor determines the degree of change: a factor greater than 1.0 brightens, less than 1.0 darkens, and 1.0 leaves the image unaltered. The command offers different modes for applying this adjustment, such as -rgb (default, applies to each color component directly), -luminosity (adjusts based on perceived brightness), and -value (based on the maximum color component). This flexibility allows for nuanced control over the brightness modification. Designed for scripting and automated image processing workflows, pambrighten is a core tool within the Netpbm ecosystem, often piped with other utilities to create complex image manipulation sequences. It's particularly valued for its simplicity and efficiency in performing this fundamental image operation.

CAVEATS

Care must be taken when using extreme brightness_value factors, as pixel values can be clipped to the maximum allowed value (e.g., 255 for 8-bit images), leading to loss of detail and saturation. The choice between -luminosity, -rgb, and -value modes significantly impacts the visual outcome, with -luminosity often yielding more natural-looking results for general photo adjustments.
The command only processes Netpbm formats; other image formats must be converted first using tools like anytopnm.

INPUT/OUTPUT

By default, pambrighten reads a Netpbm image from standard input (stdin) and writes the modified image to standard output (stdout). This design enables seamless integration into shell pipelines, allowing for chaining multiple Netpbm operations. For example, cat image.ppm | pambrighten 1.5 | pnmtopng > brighter.png demonstrates a typical workflow, where a PPM image is brightened and then converted to PNG.

HISTORY

pambrighten is an integral part of the Netpbm project, a comprehensive suite of graphics programs for converting, manipulating, and viewing image files. Netpbm itself evolved from the Pbmplus package in the early 1990s, with a focus on a modular, command-line tool philosophy. pambrighten embodies this design by providing a specific, well-defined function that can be easily combined with other Netpbm tools in shell scripts and automated workflows. Its development aligns with the continuous enhancement of the Netpbm suite to handle various image processing needs efficiently.

SEE ALSO

pamgamma(1), pamtopnm(1), anytopnm(1), netpbm(1)

Copied to clipboard