Résumé
Converts a single-band raster with a color map to a three-band (red, green, and blue) raster.
Discussion
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.
Syntaxe
ColormapToRGB (raster)
Paramètre | Explication | Type de données |
raster | The input color map raster. | Raster |
Type de données | Explication |
Raster | The output raster. |
Exemple de code
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")
Rubriques connexes
Vous avez un commentaire à formuler concernant cette rubrique ?