You are here: Rasters > RasterPaletteExtractor


Creates a string representation of an existing palette and saves it to an attribute.


Format of Palette Attributes

The general format of a palette attribute is as follows:

<value interpretation> [<string length>]

<key 0> <value 0>

<key 1> <value 1>


<key n> <value n>

The first line of the palette must contain the value interpretation. Valid values for the value interpretation are RGBA32, RGB24, RGBA64, RGB48, GRAY8, GRAY16, and STRING.

When an interpretation of STRING is specified, the first line may optionally specify the maximum string length of the palette values. This value must be a positive integer. If no string length is explicitly specified, a default of 32 will be assumed.

RGBA and RGB palette values consist of comma-delimited strings of integers between 0 and the maximum value of the datatype. For example, a valid RGBA32 value would 64,128,255,255, and a valid RGB48 value would be 16384,32768,65535.

GRAY palette values consist of a single integer between 0 and the maximum value of the datatype.

STRING palette values may consist of any arbitrary text, except for the newline character.

All lines after the first are key-value pairs. Palette keys must be organized in ascending order, but they are not required to be contiguous. For example, you can have palette entries for keys 0, 2, and 4, but not 1 or 3. All missing palette entries are assumed to look up to 0 or an equivalent value, such as 0,0,0 for RGB or an empty string for string palettes.

Palette Examples

This is an example of a color palette:


0 0,49,190

1 50,255,50

2 172,0,255

3 255,0,0

And this is an example of a string palette:


0 Water

1 Forest

2 Commercial

3 Urban

Usage Notes

This transformer supports raster band and palette selection. Exactly one palette must be selected on each input raster feature. The RasterSelector can be used to modify selection.

Related Transformers

This transformer may be used in combination with the AttributeFileWriter to write a palette to a file. This transformer can create an attribute from a palette, and then the AttributeFileWriter can be used to write that attribute to a file.

The RasterPaletteAdder may be used to do the reverse operation and create a palette from a string attribute.

Editing Transformer Parameters

Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, click beside the applicable parameter. For more information, see Transformer Parameter Menu Options.

Transformer Categories


FME Licensing Level

FME Professional edition and above



Search FME Knowledge Center

Search for samples and information about this transformer on the FME Knowledge Center.

Tags Keywords: raster grid band channel palette lookup LUT colormap colourmap attribute extract write