Skip to content

r.rgb

Splits a raster map into red, green and blue maps.

r.rgb input=name [red=name] [green=name] [blue=name] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

r.rgb input=name red=name

grass.script.run_command("r.rgb", input, red=None, green=None, blue=None, overwrite=None, verbose=None, quiet=None, superquiet=None)

Example:

gs.run_command("r.rgb", input="name", red="name")

grass.tools.Tools.r_rgb(input, red=None, green=None, blue=None, overwrite=None, verbose=None, quiet=None, superquiet=None)

Example:

tools = Tools()
tools.r_rgb(input="name", red="name")

This grass.tools API is experimental in version 8.5 and expected to be stable in version 8.6.

Parameters

input=name [required]
    Name of input raster map
red=name
    Red channel raster map name
green=name
    Green channel raster map name
blue=name
    Blue channel raster map name
--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
    Name of input raster map
    Used as: input, raster, name
red : str, optional
    Red channel raster map name
    Used as: output, raster, name
green : str, optional
    Green channel raster map name
    Used as: output, raster, name
blue : str, optional
    Blue channel raster map name
    Used as: output, raster, name
overwrite : bool, optional
    Allow output files to overwrite existing files
    Default: None
verbose : bool, optional
    Verbose module output
    Default: None
quiet : bool, optional
    Quiet module output
    Default: None
superquiet : bool, optional
    Very quiet module output
    Default: None

input : str | np.ndarray, required
    Name of input raster map
    Used as: input, raster, name
red : str | type(np.ndarray) | type(np.array) | type(gs.array.array), optional
    Red channel raster map name
    Used as: output, raster, name
green : str | type(np.ndarray) | type(np.array) | type(gs.array.array), optional
    Green channel raster map name
    Used as: output, raster, name
blue : str | type(np.ndarray) | type(np.array) | type(gs.array.array), optional
    Blue channel raster map name
    Used as: output, raster, name
overwrite : bool, optional
    Allow output files to overwrite existing files
    Default: None
verbose : bool, optional
    Verbose module output
    Default: None
quiet : bool, optional
    Quiet module output
    Default: None
superquiet : bool, optional
    Very quiet module output
    Default: None

Returns:

result : grass.tools.support.ToolResult | np.ndarray | tuple[np.ndarray] | None
If the tool produces text as standard output, a ToolResult object will be returned. Otherwise, None will be returned. If an array type (e.g., np.ndarray) is used for one of the raster outputs, the result will be an array and will have the shape corresponding to the computational region. If an array type is used for more than one raster output, the result will be a tuple of arrays.

DESCRIPTION

r.rgb generates separate red, green and blue maps from a raster map and its associated color table (grey255).

EXAMPLE

g.region raster=elevation -p
r.rgb input=elevation red=elevation.r green=elevation.g blue=elevation.b

In this case r.rgb produces in the current mapset three new raster maps - 'elevation.r', 'elevation.g', 'elevation.b'.

r_rgb_elevation

SEE ALSO

r.composite, r.blend, r.colors, r.mapcalc

AUTHOR

Glynn Clements

SOURCE CODE

Available at: r.rgb source code (history)
Latest change: Thursday Feb 20 12:48:50 2025 in commit 1633be4