Question

Merge multiple PNG from the same area with transparency into a PDF

  • 18 December 2017
  • 4 replies
  • 13 views

Badge +7

I'm making workflow that creates a layout for drawings and exports them to pdf. The lining, north arrow and all work but somehow the layers of the PNG's are not correctly exported to the PDF. When looking at the drawing in the inspector everything is transparent and also the shape of the image looks OK but somehow in the export to PDF the transparency is lost and the image gets a bit squeezed together.

I cant find the option to tackle this, for example the pdf styler made everything transparent or nothing but not only the transparent parts.


4 replies

Userlevel 4

Maybe consider merging all the tiles first using either the RasterMosaicker or perhaps the MapnikRasterizer before sending the result to the PDF writer.

Badge +7

Maybe consider merging all the tiles first using either the RasterMosaicker or perhaps the MapnikRasterizer before sending the result to the PDF writer.

 

Thanks, tried this but always got my stuff rejected so i thought it was a non-valid option. Tried it again with the RasterMosaicker, at your suggestion, and found out that if the PNG is completely empty (all values NoData) it fails and gets rejected. (problably no palette to merge). With a logger connected to the rejected port it works like it should. If the bounding box is changed and that certain layer has information everything works fine and nothing gets rejected.

 

Userlevel 2
Badge +14

Hi @JeroenR, this article works with GeoTIFFs but can also be done with PNG files and written out to PDF. It goes over how to manipulate and merge/overlay different files in FME working with transparency. https://knowledge.safe.com/articles/58374/how-to-convert-geotiff-to-ecw.html Hopefully that helps you get started.

Userlevel 4

 

Thanks, tried this but always got my stuff rejected so i thought it was a non-valid option. Tried it again with the RasterMosaicker, at your suggestion, and found out that if the PNG is completely empty (all values NoData) it fails and gets rejected. (problably no palette to merge). With a logger connected to the rejected port it works like it should. If the bounding box is changed and that certain layer has information everything works fine and nothing gets rejected. 

 

Yes, I forgot to mention that possibility. An option is to use the RasterBandMinMaxExtractor and a RasterBandPropertyExtractor and check for 

 

_band{}.min == _band{}.max == _band{}.band_nodata
For bands where that's the case, you can assume the band is completely empty and treat it accordingly.

 

 

Unfortunately this can be a bit slow if you have lots of rasters and/or bands, so you should probably weigh this up against your current solution.

Reply