Skip to content

r.blend

Blends color components of two raster maps by a given ratio.

r.blend [-c] first=name second=name output=basename [percent=float] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

r.blend first=name second=name output=basename

grass.script.run_command("r.blend", first, second, output, percent=50, flags=None, overwrite=None, verbose=None, quiet=None, superquiet=None)

Example:

gs.run_command("r.blend", first="name", second="name", output="basename")

grass.tools.Tools.r_blend(first, second, output, percent=50, flags=None, overwrite=None, verbose=None, quiet=None, superquiet=None)

Example:

tools = Tools()
tools.r_blend(first="name", second="name", output="basename")

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

Parameters

first=name [required]
    Name of first raster map for blending
second=name [required]
    Name of second raster map for blending
output=basename [required]
    Basename for red, green and blue output raster maps
percent=float
    Percentage weight of first map for color blending
    Allowed values: 0-100
    Default: 50
-c
    Combine resulting R,G,B layers into single output map
--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

first : str, required
    Name of first raster map for blending
    Used as: input, raster, name
second : str, required
    Name of second raster map for blending
    Used as: input, raster, name
output : str, required
    Basename for red, green and blue output raster maps
    Used as: output, raster, basename
percent : float, optional
    Percentage weight of first map for color blending
    Allowed values: 0-100
    Default: 50
flags : str, optional
    Allowed values: c
    c
        Combine resulting R,G,B layers into single output map
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

first : str | np.ndarray, required
    Name of first raster map for blending
    Used as: input, raster, name
second : str | np.ndarray, required
    Name of second raster map for blending
    Used as: input, raster, name
output : str | type(np.ndarray) | type(np.array) | type(gs.array.array), required
    Basename for red, green and blue output raster maps
    Used as: output, raster, basename
percent : float, optional
    Percentage weight of first map for color blending
    Allowed values: 0-100
    Default: 50
flags : str, optional
    Allowed values: c
    c
        Combine resulting R,G,B layers into single output map
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.

Raises:

grass.tools.ToolError: When the tool ended with an error.

DESCRIPTION

r.blend blends color components of 2 raster maps by a specified percentage of the first map.

EXAMPLE

Blending the aspect map with the elevation map for a shaded map (North Carolina sample dataset):

g.region raster=elevation
r.relief input=elevation output=relief zscale=10
r.blend -c first=elevation second=relief output=blend percent=75

r.blend example
Figure: Elevation blended with shaded relief

SEE ALSO

d.shade, g.region, r.shade, r.colors, r.his, r.mapcalc, r.rgb, r.support

AUTHORS

Unknown: probably CERL
Updated to GRASS 5.7 by Michael Barton, Arizona State University

SOURCE CODE

Available at: r.blend source code (history)
Latest change: Saturday Apr 19 17:44:03 2025 in commit 24d7441