Skip to content

d.rgb

Displays three user-specified raster maps as red, green, and blue overlays in the active graphics frame.

d.rgb [-n] red=name green=name blue=name [--verbose] [--quiet] [--qq] [--ui]

Example:

d.rgb red=name green=name blue=name

grass.script.run_command("d.rgb", red, green, blue, flags=None, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("d.rgb", red="name", green="name", blue="name")

Parameters

red=name [required]
    Name of raster map to be used for <red>
green=name [required]
    Name of raster map to be used for <green>
blue=name [required]
    Name of raster map to be used for <blue>
-n
    Make null cells opaque
--help
    Print usage summary
--verbose
    Verbose module output
--quiet
    Quiet module output
--qq
    Very quiet module output
--ui
    Force launching GUI dialog

red : str, required
    Name of raster map to be used for <red>
    Used as: input, raster, name
green : str, required
    Name of raster map to be used for <green>
    Used as: input, raster, name
blue : str, required
    Name of raster map to be used for <blue>
    Used as: input, raster, name
flags : str, optional
    Allowed values: n
    n
        Make null cells opaque
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

d.rgb displays three user-specified raster maps as red, green, and blue overlays in the active graphics frame.

RGB stands for red, green, and blue. d.rgb visually combines three raster maps to form a color image. For each map, the corresponding component from the layer's color table is used (e.g. for the red layer, the red component is used, and so on). In general, the input raster maps should use a grey-scale color table.

NOTES

d.rgb does not attempt to quantize the combined image into a fixed number of colors. Nor does it have an option to generate a composite layer (see r.composite for that). The image and raster maps will not display properly if the graphics device does not have a reasonable sampling of the RGB color-space.

If color quality of satellite image color composites seems to appear poor, run i.colors.enhance on the selected satellite channels.

An alternative is the assignment of grey color tables to each band with r.colors:

r.info -r image.1

min=0
max=255

r.colors map=image.1 color=grey

r.colors map=image.2 rast=image.1
r.colors map=image.3 rast=image.1

To write out the color composite to a combined R/G/B raster maps, use r.composite.

EXAMPLE

Visual color composite of a LANDSAT scene (North Carolina sample dataset):

g.region raster=lsat7_2002_10 -p
d.rgb blue=lsat7_2002_10 green=lsat7_2002_20 red=lsat7_2002_30

d.rgb example
Figure: Visual color composite of a LANDSAT scene (North Carolina sample dataset)

SEE ALSO

d.colortable, d.his, r.blend, r.mapcalc, r.colors, r.composite

AUTHOR

Glynn Clements

SOURCE CODE

Available at: d.rgb source code (history)
Latest change: Wednesday Feb 12 23:02:46 2025 in commit 9c11460