Skip to content

r.colors.contrastbrightness

Change the contrast/brightness of a raster.

r.colors.contrastbrightness input=name output=name minimum=value maximum=value contrast=value brightness=value [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

r.colors.contrastbrightness input=name output=name minimum=value maximum=value contrast=1.0 brightness=0.0

grass.script.run_command("r.colors.contrastbrightness", input, output, minimum, maximum, contrast=1.0, brightness=0.0, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("r.colors.contrastbrightness", input="name", output="name", minimum=value, maximum=value, contrast=1.0, brightness=0.0)

Parameters

input=name [required]
    Raster map to change the contrast of.
output=name [required]
    Name for output raster map
minimum=value [required]
    Minimum input/output data value
maximum=value [required]
    Maximum input/output data value
contrast=value [required]
    Contrast (gain, 8bit=>[1.0-3.0]
    Default: 1.0
brightness=value [required]
    Brightness (bias, 8bit=>[0.0-100.0])
    Default: 0.0
--overwrite
    Allow output files to overwrite existing files
--help
    Print usage summary
--verbose
    Verbose module output
--quiet
    Quiet module output
--qq
    Very quiet module output
--ui
    Force launching GUI dialog

input : str, required
    Raster map to change the contrast of.
    Used as: input, raster, name
output : str, required
    Name for output raster map
    Used as: output, raster, name
minimum : float, required
    Minimum input/output data value
    Used as: value
maximum : float, required
    Maximum input/output data value
    Used as: value
contrast : float, required
    Contrast (gain, 8bit=>[1.0-3.0]
    Used as: value
    Default: 1.0
brightness : float, required
    Brightness (bias, 8bit=>[0.0-100.0])
    Used as: value
    Default: 0.0
overwrite: bool, optional
    Allow output files to overwrite existing files
    Default: False
verbose: bool, optional
    Verbose module output
    Default: False
quiet: bool, optional
    Quiet module output
    Default: False
superquiet: bool, optional
    Very quiet module output
    Default: False

DESCRIPTION

The r.colors.contrastbrightness module generates a contrasted version of the input raster map. The contrast is the gain of the affine transform, use values of 1.0-3.0 in case of an 8 bit image. The brightness is the bias of the affine transform, use values of 0.0-100.0 in case of an 8 bit image.

EXAMPLES

Contrast enhancement of an 8-bit raster band This does nothing to the image:

r.colors.contrastbrightness min=0.0 max=255.0 contrast=1.0 brightness=0.0 input=myinraster output=myoutraster

This does change the contrast of the image:

r.colors.contrastbrightness min=0.0 max=255.0 contrast=3.0 brightness=0.0 input=myinraster output=myoutraster

This does change the brightness of the image:

r.colors.contrastbrightness min=0.0 max=255.0 contrast=1.0 brightness=100.0 input=myinraster output=myoutraster

SEE ALSO

r.colors, v.colors, r3.colors, r.cpt2grass, r.colors.matplotlib

AUTHOR

Yann Chemin, JRC, Ispra, Italy

SOURCE CODE

Available at: r.colors.contrastbrightness source code (history)
Latest change: Thursday Feb 20 13:02:26 2025 in commit 53de819