Add Colormap (Data Management)

License Level:BasicStandardAdvanced

Summary

Adds a color map to a raster dataset if it does not already exist or replaces a color map with the one specified.

Usage

Syntax

AddColormap_management (in_raster, {in_template_raster}, {input_CLR_file})
ParameterExplanationData Type
in_raster

The input raster dataset to which you want to add a color map.

Raster Layer
in_template_raster
(Optional)

The raster dataset with a color map, that will be applied to the input raster dataset. If this is entered the input_CLR_file cannot be specified.

Raster Layer
input_CLR_file
(Optional)

The .clr or .act file, which will be used as the template color map for the input raster dataset. If this is entered the in_template_raster cannot be specified.

File

Code Sample

AddColormap example (Python window)

This is a Python sample for AddColormap.

import arcpy
arcpy.AddColormap_management("c:/data/nocolormap.img", "#",
                             "colormap_file.clr")
AddColormap example 2 (stand-alone script)

This is a Python script sample for AddColormap.

##====================================
##Add Colormap
##Usage: AddColormap_management in_raster {in_template_raster} {input_CLR_file}

try:
    import arcpy
    arcpy.env.workspace = r"C:/Workspace"
    
    ##Assign colormap using template image
    arcpy.AddColormap_management("nocolormap.img", "colormap.tif", "#")
    
    ##Assign colormap using clr file
    arcpy.AddColormap_management("nocolormap.img", "#", "colormap_file.clr")

except:
    print "Add Colormap example failed."
    print arcpy.GetMessages()

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
11/18/2013