Skip to main content
Question

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

  • December 18, 2017
  • 4 replies
  • 77 views

jeroen
Contributor
Forum|alt.badge.img+8

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

david_r
Celebrity
  • December 18, 2017

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


jeroen
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • December 22, 2017
david_r wrote:

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.

 


LizAtSafe
Safer
Forum|alt.badge.img+15
  • Safer
  • December 22, 2017

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.


david_r
Celebrity
  • January 3, 2018
jeroen wrote:

 

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings