Syntax @GenerateRasterPalettes([REJECTABLE], [,]) Arguments REJECTABLE Specifies if the function will supply a rejection code and message to the invalid feature and output it to the rejected port, or will fail upon being supplied invalid features. A feature can be rejected for the following reasons: - The feature has invalid geometry - The raster has incompatible bands for palette-generation The desired key interpretation for the new palette, including data type and bit depth. UINT8 has at most 256 palette entries. UINT16 has at most 65,536 palette entries. UINT32 has at most 4,294,967,296 palette entries. Range: UINT8 | UINT16 | UINT32 The actual number of entries in the new palette. The palette key interpretation may allow more entries in the palette, but this number sets the maximum number of entries to be generated. The minimum number is 1. This number cannot exceed the maximum number of entries in the palette key interpretation. Range: positive integers Description The @GenerateRasterPalettes function is used to generate a palette from a raster without a palette. This function removes the selected band(s) from a raster and produces a new band and a new palette. The function replaces the values on the selected band(s) by the palette keys on the new band and the values on the new palette. This process often greatly reduce the size of the output raster. This also implies that the output raster has only as many different colors as the new palette. When the input raster has more different colors than the specified number of colors in the function parameter, the color reduction mechanism in the function will merge similar colors to make sure that the maximum number of colors in the palette will not exceed the specified number in the parameter. Since this function can be used to generate a palette from a raster without a palette, translations from raster formats that do not produce a palette, to raster formats that require a palette are possible now. For example, when a raster writer, such as the GIFRASTER and the PNGRASTER, requires a palette, this function can be used to generate a palette from the source raster, such as the JPEG and the ECW, which does not have a palette. In details, the selected band(s) of the input raster will be replaced by a new band with the specified palette key interpretation. This new band will have a new palette. The interpretations of the selected band(s) determine the value interpretation of the palette. For example, if the interpretations of the selected bands are RED8, GREEN8, and BLUE8, the value interpretation of the new palette will be RGB24. The specified maximum number of palette entries determines the maximum number of palette entries to be generated in the new palette. This number is useful in some situations. For example, XPM can write at most 87 entries in a palette, whereas GeoTIFF can write at most 2,147,483,648 entries. To standardize the number of entries and the color in the palettes being written to both formats, the @GenerateRasterPalettes function can be used by setting the key interpretation to UINT8 and the maximum number of palette entries to 87 before passing the raster feature to the writers of both formats. This operation is lossy. The maximum number of entries determines the quality of the output raster. More number of entries implies higher quality. The two arguments allow the function to generate a palette that can contain more entries than the actual number of entries to be generated. However, the specified maximum number of entries must not be larger than the number of entries of the specified key interpretation. The selected band(s) determines the value interpretation of the palette. Therefore, the selected band(s) must be in the correct order in the raster, and the interpretations of the selected band(s) must be a meaningful palette value interpretation that FME currently supports. A bad example would be that the selected bands are RED8, GREEN16, and BLUE8 in order. Another bad example would be that the selected bands are GREEN8, BLUE8, and RED8 in order. Furthermore, the selected band(s) cannot have any palettes. Please note that if the selected bands are all UINT8 but the intended palette value interpretation is RGB24, the selected bands must be reinterpreted first. This function supports sub-selection of raster bands.