ColormapToRGB

Zusammenfassung

Converts a single-band raster with a color map to a three-band (red, green, and blue) raster.

Auswertung

For more information about how this function works, see the Colormap To RGB raster function.

The referenced raster dataset for the raster object is temporary. To make it permanent, you can call the raster object's save method.

Syntax

ColormapToRGB (raster)
ParameterErklärungDatentyp
raster

The input color map raster.

Raster
Rückgabewert
DatentypErklärung
Raster

The output raster.

Codebeispiel

ColormapToRGB example 1

This example converts the raster with a color map to an RGB 3bands raster.

from arcpy.sa import *
out_slope_with_colormap = ColormapToRGB("elevation_raster.tif")
out_slope_rgb_3bands.save("C:/arcpyExamples/outputs/elevtion_rgb_3bands.tif")
ColormapToRGB example 2

This example converts the raster with a color map to an RGB 3bands raster.

# Import system modules
import arcpy
from arcpy.sa import *

# Set the analysis environments
arcpy.env.workspace = "C:/arcpyExamples/data"

# Set the local variables
in_raster = "slope_raster.tif"

# convert the raster with colormap to a RGB 3bands raster
out_slope_rgb_3bands = ColormapToRGB(in_raster)

# save the output
out_slope_rgb_3bands.save("C:/arcpyExamples/outputs/slope_rgb_3bands.tif")

Verwandte Themen