Skip to main content

Hi,

 

we have some problems during clipping raster datasets!

So the black area in the example is successfully clipped.

image But then as result we have raster clipped by clipper. But FME makes the raster square again and fills the missing pixels black.

image 

I can remove these nodata values but then sometime black pixels inside the raster are also deleted not only the black areas on the edge! We want to get only the clipped area without black areas. It does not have to be square.

Is this possible?

Hi @limo​,

All raster datasets are naturally rectangular, so the black areas will always be included. However there are two ways to make them transparent in most image viewing tools:

  • for single band datasets (ie. DEMs, monochrome images), a band value can be set to NoData. This works best for numeric datasets, since there is usually a wide range of rarely used values to choose from (ie. -9999). Monochrome imagery has a much smaller range (0-255), so usually 0 or 255 is chosen, and hopefully this doesn't catch any proper image values. You can use the RasterBandNodataSetter to set the NoData value before clipping. The Clipper will automatically assign outside pixels to the NoData value if it is set.
  • For color or multi-band imagery you can get better results by adding an Alpha band to control transparency. The Clipper will automatically set the Alpha band to full transparent outside of the clip area. The easiest way to add the Alpha band is to use the RasterInterpretationCoercer to coerce from RGB24 to RGBA32, but you can also use the RasterBandAdder to add an Alpha band. This step must be done before clipping. Most image formats support Alpha, but one notable exception is JPEG. If you want transparent edges on an irregular dataset, I recommend saving as PNG or TIFF instead.

thanks @daveatsafe​ .

 

this is exactly what I was looking for.

It works good for me :)

 

I now get this result:

image 

thanks a lot :)


Reply