FME Transformers: 2024.1

Related Transformers


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

Jump to Configuration

Typical Uses

  • Extracting a palette to be saved to an external file
  • Extracting a palette to apply to other rasters or for use elsewhere in a workspace

How does it work?

The RasterPaletteExtractor receives raster features and copies the palette information to a string attribute. Only one palette may be extracted at a time.

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.

This transformer may be used in combination with the AttributeFileWriter to write a palette to a file.

Format of Palette Attributes

The general format of a palette attribute is as follows:


RGB Example

String Example

<value interpretation> [<string length>]
<key 0> <value 0>
<key 1> <value 1>
<key n> <value n>

0 0,49,190
1 50,255,50
2 172,0,255
3 255,0,0

0 Water
1 Forest
2 Commercial
3 Urban

The first line of the palette must contain the value interpretation. Valid values for the value interpretation are:

  • RGB24
  • RGBA32
  • RGB48
  • RGBA64
  • GRAY8
  • GRAY16

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

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.

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

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

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 - that is, not all numbers in the series must be present. All absent palette keys look up to 0 or an equivalent value, such as 0,0,0 for RGB or an empty string for string palettes.


Usage Notes

Choosing a Raster Transformer

FME has an extensive selection of transformers for working with raster data. They can be generally categorized as working with whole rasters, bands, cells or palettes, and those designed for workflow control or combining raster with vector data.

For information on raster geometry and properties, see Rasters (IFMERaster).


Input Ports

Output Ports


Editing Transformer Parameters

Transformer parameters can be set by directly entering values, using expressions, or referencing other elements in the workspace such as attribute values or user parameters. Various editors and context menus are available to assist. To see what is available, click beside the applicable parameter.

For more information, see Transformer Parameter Menu Options.


Processing Behavior


Feature Holding


Dependencies None

FME Community

The FME Community is the place for demos, how-tos, articles, FAQs, and more. Get answers to your questions, learn from other users, and suggest, vote, and comment on new features.

Search for all results about the RasterPaletteExtractor on the FME Community.


Examples may contain information licensed under the Open Government Licence – Vancouver, Open Government Licence - British Columbia, and/or Open Government Licence – Canada.