Add Colormap (Data Management)

Summary

Adds a new color map or replaces an existing color map on a raster dataset.

Usage

  • The color map applied to the input raster dataset can originate from a raster dataset that already has a color map, a .clr file, or an .act file.

  • This tool will not work when the color map is internally stored in the attribute table of an IMG or a TIFF dataset. If the attribute table contains the fields Red, Green, and Blue, this tool cannot be used.

  • The input raster dataset must be a single band raster dataset with integer values. Color maps can only be created for single-band raster datasets with a pixel depth of 16-bit unsigned or fewer. Certain formats cannot have a color map associated with them; please consult Supported raster dataset file formats.

Parameters

LabelExplanationData Type
Input Raster

The raster dataset to add or replace a color map.

Raster Layer
Input Template Raster
(Optional)

A raster dataset that has a color map that you want to apply to the input raster dataset.

Raster Layer
Input .clr or .act File
(Optional)

Specify a .clr or .act file to use as the color map.

File

Derived Output

LabelExplanationData Type
Updated Input Raster

The output raster dataset.

Raster Layer

arcpy.management.AddColormap(in_raster, {in_template_raster}, {input_CLR_file})
NameExplanationData Type
in_raster

The raster dataset to add or replace a color map.

Raster Layer
in_template_raster
(Optional)

A raster dataset that has a color map that you want to apply to the input raster dataset. If this is entered the input_CLR_file parameter is ignored.

Raster Layer
input_CLR_file
(Optional)

Specify a .clr or .act file to use as the color map.

File

Derived Output

NameExplanationData Type
out_raster

The output raster dataset.

Raster Layer

Code sample

AddColormap example (Python window)

This is a Python sample for the AddColormap tool.

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 the AddColormap tool.

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

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")

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics