Skip to main content

I have a (4KB) png file I want to convert to a vector grid. I want each pixel in the raster to be its own cell in the vector grid.

I am using RasterCellCoercer

Output Cell Geometery: Polygons

Extract Band Values As: Attributes

Extract Nodata Values: Yes

My question is how do I transfer the colour values of the raster to attribute values in the vector?

Hi @nicholas,

There is a custom transformer that can help you do this. After the RasterCellCoercer:

  1. Add an AttributeManager or Creator to create a single RGB attribute from the raster band cell values, set the new value to:
@Value(_band{0}.value),@Value(_band{1}.value),@Value(_band{2}.value)
  1. Add a custom transformer, the ColorConverter, to convert this value to FME colours
  2. Add a FeatureColorSetter and set the colour scheme to 'Fixed' and the fill color to the _output_color created by the custom transformer.


You can just create an attribute

for 8bit

fme_fill_color =

@Evaluate(@Value(_band{0}.value)/256),@Evaluate(@Value(_band{1}.value)/256),@Evaluate(@Value(_band{2}.value)/256)

(use texteditor to avoid further Evaluation!!)

(fme_color for borders)


You can just create an attribute

for 8bit

fme_fill_color =

@Evaluate(@Value(_band{0}.value)/256),@Evaluate(@Value(_band{1}.value)/256),@Evaluate(@Value(_band{2}.value)/256)

(use texteditor to avoid further Evaluation!!)

(fme_color for borders)

Wouldn't that be divide by 255? The 256th value is 0.