atom feed7 messages in org.apache.xmlgraphics.fop-usersRe: Problem with rendering PNG images
FromSent OnAttachments
Jean-François El FoulyApr 22, 2008 5:57 am 
Peter CoppensApr 22, 2008 6:07 am 
Jean-François El FoulyApr 22, 2008 6:23 am 
Peter CoppensApr 22, 2008 6:30 am 
Jeremias MaerkiApr 24, 2008 12:46 am 
Jean-François El FoulyApr 24, 2008 1:18 am 
Jeremias MaerkiApr 24, 2008 1:43 am 
Subject:Re: Problem with rendering PNG images
From:Jeremias Maerki (de@jeremias-maerki.ch)
Date:Apr 24, 2008 12:46:44 am
List:org.apache.xmlgraphics.fop-users

Sorry for chiming in late. I'm afraid it's not the same problem Peter mentioned. That particular problem I fixed was exclusively about JPEG images with an embedded RGB color profile.

With PNG images, the case is different. It's a problem that has come up a number of times on this mailing list and I always had to give the same somewhat unsatisfying answer: By default, PNG images are in the sRGB color space. We're not in device RGB mode anymore. Acrobat runs the PDF through color management in order to try (!) to reproduce the colors of a document exactly the same when you look at a printed copy. Not all output devices (computer screens & printers) support the same range of colors. Furthermore, toner and inks have different physical properties which affect color perception. Long talk short and certainly a simplification: What you're seeing is a side effect of color management. When viewing the same PDF in a PDF viewer (like GhostView) that doesn't do color management you get those fully saturated colors on the screen.

I'm not sure that your comment about gamma correction would help much here as I have the same results for images loaded from bitmap formats that don't provide gamma correction hints. But it might still affect the rendering a little bit if done wrong.

Anyway, we currently don't have an expert on color management around here. I'm still learning (it's a very complex topic) and improved a few things over time. But there could still be some bugs which I cannot even identify.

I've done a short experiment in Scribus (Open Source DTP) which allows to nicely demonstrate the effects of color management. You can freely switch color management on and off and manipulate all sorts of parameters. As soon as I switch on printer simulation I get a similar effect as in Acrobat. But in Acrobat Reader I haven't found out how to disable this. Looking at the PDFs generated by Scribus (after playing with some settings) I get the impression the whole thing could be improved by us understanding rendering intents. This is something FOP currently doesn't deal with.

On 22.04.2008 15:08:04 Peter Coppens wrote:

We have recently reported something similar (it might have been in private to Jeremias...can't remember) and he fixed that problem just this week. It was related to a color profile being truncated (or something like that). Might be the same issue. Perhaps you can try the trunk version of fop or post one of your images.

Hth,

Peter

On 22 Apr 2008, at 14:57, Jean-François El Fouly wrote:

I have a problem with the way PNG images are rendered. I'm writing tools to manage aircraft technical documentations. One of the documents is the "Pilot's Guide", it has quite a lot of cockpit screens screenshots. The source image files are all PNG's, and they have very bright, fully saturated colours such as bright green (0,255,0) -- on black. Yet these images are rendered by FOP in the target PDF with dull colors, rather pale green, pale yellow, pale magenta -- and obviously the customer rejects the document as it is now.

Adobe Acrobat Professional seems to tell in the properties that the generated PDF document is CMYK, while the source images are obviously RGB. But I'm not quite sure we understand and interpret this correctly, so take this hint with a pinch of salt.

I've looked in quite a lot of directions such as manipulating source images and target resolutions to prevent image resizing (source = target = 300 dpi), or investigated JAI related questions but to no avail. My feeling, reading pieces of the FOP 0.94 source code (ImageFactory) is that JAI is not used at all for the processing of PNG images, it all seems to occur between ImageIO and a PNGImage class that use Apache xmlgraphics own codec.

Could the problem be related to the gamma correction param.setPerformGammaCorrection(true); that is used in PNGImage ?

By now, all in all, I'm puzzled and can't figure what's happening and how to find a solution to this problem.

If someone has an idea I'd be soooooo grateful ;-)