Hi, thank you for pointing me to that class, it is the first time I see such a thing work and I hopefully would be able to use it to achieve viable solution. I went through the example and you've said that I should have "set the transparency". I did not noticed such thing anywhere in the example, there is just straight up load, which creates a BufferedImage with the color model that has a Transparency type BITMASK. If I load the PNG I've attached in the same fashion as it is in the LosslessFactoryTest, I get Transparency type TRANSLUCENT. I have to therefore disable couple of asserts and validations, but at the end it produces the pdf output as it was with the gif, with 1 major difference, no transparency kept from PNG.
Why did I made an "inception like" image load? I am actually generating the PNG programatically as an input. I've met with issues when it came to achieving transparency, the first thing that worked was creating a first image that was transparent and use its ImageData as a source for the final java.awt.Image. Also the stackoverflow comment claimed it worked after some version. That's just the reasoning why I went for it, not claiming it is the correct thing to do. % 0a%0aon%202016-09-28%2018%3a25%20%28+0200%29%2c%20tilman%20hausherr%20%[email protected] %3E%20wrote%3A%20%0A%3E%20Btw%20you%20%28and%20the%20person%20who%20wrote%20the%20stackoverflow%20question%29%20are%20%3E%20%0A%3E%20drawing%20an%20image%20onto%20an%20image.%20Why%20would%20you%20think%20that%20this%20produces%20%3E%20%0A%3E%20transparancy%3F%3E%20%0A%3E%20%0A%3E%20You%20need%20to%20find%20a%20way%20to%20have%20it%20transparent%20-%20either%20because%20the%20PNG%20%3E%20%0A%3E%20file%20has%20transparent%20areas%20%28can%27t%20remember%20if%20this%20is%20supported%29%2C%20or%20by%20%3E%20%0A%3E%20setting%20the%20alpha%20yourself.%3E%20%0A%3E%20%0A%3E%20Tilman%3E%20%0A%3E%20%0A%3E%20Am%2028.09.2016%20um%2015%3A00%20schrieb%20J%uFFFDn%20Ka%5Cu0161%5Cu0161ovic%3A%3E%20%0A%3E%20%3E%20Hi%20all%2C%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%20I%27m%20trying%20to%20insert%20PNG%20image%20with%20transparent%20background%20to%20PDF%20using%3E%20%0A%3E%20%3E%20PDFBox.%20From%20what%20I%27ve%20read%20it%20seems%20like%20this%20should%20be%20working%2C%20but%20it%20is%3E%20%0A%3E%20%3E%20not.%20Please%2C%20can%20you%20help%20me%20to%20achieve%20this%3F%3E%20%0A%3E%20%3E%20It%20does%20not%20necessarily%20has%20to%20be%20PNG%2C%20I%20am%20happy%20to%20use%20any%20common%20image%3E%20%0A%3E%20%3E%20type%20that%20supports%20transparency.%20I%20am%20using%20PDFBox%202.0.0%20with%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%20my%20method%20is%20here%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%20*%20private%20static%20void%20insertImage%28PDDocument%20document%2C%20File%20imageFile%2C%3E%20%0A%3E%20%3E%20PDRectangle%20rectangle%29%20throws%20IOException%20%7B%20%20%20%20%20%20%20%20BufferedImage%20tmpImage%20%3D%3E%20%0A%3E%20%3E%20ImageIO.read%28imageFile%29%3B%20%20%20%20%20%20%20%20BufferedImage%20bufferedImage%20%3D%20new%3E%20%0A%3E%20%3E%20BufferedImage%28tmpImage.getWidth%28%29%2C%20tmpImage.getHeight%28%29%2C%3E%20%0A%3E%20%3E%20BufferedImage.TYPE_INT_ARGB%29%3B%3E%20%0A%3E%20%3E%20bufferedImage.createGraphics%28%29.drawRenderedImage%28tmpImage%2C%20null%29%3B%3E%20%0A%3E%20%3E%20PDImageXObject%20image%20%3D%20LosslessFactory.createFromImage%28document%2C%3E%20%0A%3E%20%3E%20bufferedImage%29%3B%20%20%20%20%20%20%20%20PDPage%20page%20%3D%20document.getPage%280%29%3B%20%20%20%20%20%20%20%20try%3E%20%0A%3E%20%3E%20%28PDPageContentStream%20contentStream%20%3D%20new%20PDPageContentStream%28document%2C%3E%20%0A%3E%20%3E%20page%2C%20AppendMode.APPEND%2C%20true%29%29%20%7B%20%20%20%20%20%20%20%20%20%20%20%20float%20x%20%3D%3E%20%0A%3E%20%3E%20rectangle.getLowerLeftX%28%29%3B%20%20%20%20%20%20%20%20%20%20%20%20float%20y%20%3D%3E%20%0A%3E%20%3E%20rectangle.getLowerLeftY%28%29%3B%20%20%20%20%20%20%20%20%20%20%20%20float%20width%20%3D%3E%20%0A%3E%20%3E%20rectangle.getWidth%28%29%3B%20%20%20%20%20%20%20%20%20%20%20%20float%20height%20%3D%3E%20%0A%3E%20%3E%20rectangle.getHeight%28%29%3B%20%20%20%20%20%20%20%20%20%20%20%20contentStream.drawImage%28image%2C%20x%2C%20y%2C%3E%20%0A%3E%20%3E%20width%2C%20height%29%3B%20%20%20%20%20%20%20%20%7D%20%20%20%20%7D*%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%20or%20here%20http%3A// pastebin.com/6uwpT2Se%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%20The%20image%20I%20use%20is%20here%20https%3A//postimg.org/image/53de24lhh/%3E%20%0A%3E%20%3E%3E%20%0A%3E%20%3E%20It%20believe%20it%20is%20related%20to%20the%20Stackoverflow%20question%3E%20%0A%3E%20%3E%20http%3A//stackoverflow.com/questions/23697046/draw-transparent-png-in-pdfbox%3e%20%0a%3e%20%3e%3e%20%0a%3e%20%3e%20thanks%20in%20advance%2c%20hope%20i%20did%20use%20this%20mailinglist%20mechanism%20correctly%20%3b%29%3e%20%0a%3e%20%3e%3e%20%0a%3e%20%3e%20jan%3e%20%0a%3e%20%3e%3e%20%0a%3e%20%0a%3e%20%0a%3e%20---------------------------------------------------------------------%3e%20%0a%3e%20to%20unsubscribe%2c%20e-mail%3a%[email protected]%3e%20%0a%3e%20for%20additional%20commands%2c%20e-mail%3a%[email protected]%3E%20%0A%3E%20%0A%3E%20

