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 [-f=<fraction>] [-black=<value>] [pnmfile]

PARAMETERS

-f=<fraction>
    Brightness adjustment factor (real number, default: 0.5). Multiplies samples by (1 + fraction); positive values brighten, negative darken.

-black=<value>
    Black level threshold (0.0-1.0, default: 0.0). For brightening (<code>fraction > 0</code>), samples ≤ value stay unchanged to avoid noise.

DESCRIPTION

The pambrighten command is part of the Netpbm graphics toolkit. It reads a PNM (Portable aNyMap) image from standard input or a named file and increases its brightness by multiplying each pixel sample by (1 + fraction), where fraction is a user-specified real number (default: 0.5).

This operation applies independently to every sample in the image, supporting PBM (monochrome), PGM (grayscale), PPM (color), and PAM formats. For positive fractions (brightening), a black threshold prevents noise amplification in dark areas: samples at or below the threshold remain unchanged, while others are scaled.

For darkening (negative fractions), scaling applies without the threshold. Results exceeding the input maxval are clipped to maxval, potentially losing detail without warning. The output retains the input's format, dimensions, maxval, and tuple type, written to standard output.

pambrighten is useful for quick brightness adjustments in batch processing pipelines, such as enhancing scanned documents or preparing images for printing. It performs linear scaling only—no gamma correction or histogram equalization.

CAVEATS

Clips values exceeding maxval without warning; linear scaling ignores perceptual brightness (no gamma). Input must be PNM/PAM; large fractions may cause overflow.

ALGORITHM

For each sample s:
- If fraction ≥ 0 and s ≤ black: news = black
- Else if fraction ≥ 0: news = s * (1 + fraction)
- Else: news = s * (1 + fraction)
Clip to [0, maxval].

EXAMPLE

pambrighten -f=0.3 image.pgm > brighter.pgm
Brightens image.pgm by 30%.

HISTORY

New in Netpbm 9.21 (June 2002); evolved from grayscale-only pgmbrighten. Developed by Jef Poskanzer and Netpbm contributors for portable image manipulation.

SEE ALSO

pamdim(1), pamarith(1), pnm(5), pam(5)

Copied to clipboard