Resumen
Converts a single-band raster with a color map to a three-band (red, green, and blue) raster.
Debate
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.
Sintaxis
ColormapToRGB (raster)
Parámetro | Explicación | Tipo de datos |
raster | The input color map raster. | Raster |
Tipo de datos | Explicación |
Raster | The output raster. |
Muestra de código
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")
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")