Bug 45809 - PNGs are rendered with dull colors
Summary: PNGs are rendered with dull colors
Status: NEW
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: images (show other bugs)
Version: all
Hardware: PC Windows XP
: P3 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-15 07:11 UTC by Jean-François El Fouly
Modified: 2012-04-07 01:51 UTC (History)
0 users



Attachments
A screenshot illustrating the problem (63.75 KB, image/png)
2008-09-15 07:11 UTC, Jean-François El Fouly
Details
FO file (804 bytes, application/octet-stream)
2008-09-15 07:13 UTC, Jean-François El Fouly
Details
The test image. (85 bytes, image/png)
2008-09-15 07:13 UTC, Jean-François El Fouly
Details
The generated PDF (5.31 KB, application/pdf)
2008-09-15 07:14 UTC, Jean-François El Fouly
Details
The PDF obtained without a soft mask (5.02 KB, application/pdf)
2008-09-15 08:35 UTC, Jean-François El Fouly
Details
The Java source that generated the test image (1.29 KB, application/octet-stream)
2008-09-15 08:50 UTC, Jean-François El Fouly
Details
Image dump in the PDF (11.88 KB, image/png)
2008-09-15 08:52 UTC, Jean-François El Fouly
Details
Soft mask dump from the PDF (13.03 KB, image/png)
2008-09-15 08:54 UTC, Jean-François El Fouly
Details
Test case with changing background (1.17 KB, application/octet-stream)
2008-09-16 00:42 UTC, Jean-François El Fouly
Details
PDF render with different backgrounds. (5.34 KB, application/pdf)
2008-09-16 00:43 UTC, Jean-François El Fouly
Details
Same test case, FOP patched to add /AIS false (5.33 KB, application/pdf)
2008-10-12 16:27 UTC, Jean-François El Fouly
Details
Same test case, FOP patched to add /AIS true (5.32 KB, application/pdf)
2008-10-12 16:27 UTC, Jean-François El Fouly
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-François El Fouly 2008-09-15 07:11:35 UTC
Created attachment 22567 [details]
A screenshot illustrating the problem

At least some 24-bit PNG files, but probably all of them, are rendered by FOP with dull colors (see example.png).
This can be seen even in a simple 8 pixel example. The image and its colors are correct (object 11 in the PDF); and the soft mask too (object 10 in the PDF). So there could be a problem with the ICC color profile after all (obj 5).
Comment 1 Jean-François El Fouly 2008-09-15 07:13:00 UTC
Created attachment 22568 [details]
FO file

FO source file for the example.
Comment 2 Jean-François El Fouly 2008-09-15 07:13:34 UTC
Created attachment 22569 [details]
The test image.
Comment 3 Jean-François El Fouly 2008-09-15 07:14:23 UTC
Created attachment 22570 [details]
The generated PDF
Comment 4 Jean-François El Fouly 2008-09-15 08:35:59 UTC
Created attachment 22572 [details]
The PDF obtained without a soft mask

This PDF is generated without a PDF soft mask by commenting out this.softmask =... in ImageRenderedAdapter.java:102
The colors are now bright and the PDF no longer has a soft mask bound to the image. But the third pixel from the left is now rendered opaque, while it should be completely transparent (thus, gray here).
It's hard to understand whether the soft mask is conceptually "on top" of the image (thus, making the colors dull by interposing a sort of "veil") or related to the image transparency, thus between the image and the media ?
Comment 5 Jean-François El Fouly 2008-09-15 08:50:34 UTC
Created attachment 22573 [details]
The Java source that generated the test image

This is a fully stripped-down version of the custom cockpit-screenshots generator/editor that is used by our customer. Creates the test image in pretty much the same technical context as the "real" ones.
Comment 6 Jeremias Maerki 2008-09-15 08:51:46 UTC
For reference: http://markmail.org/message/ykcb7re4bm4xyufs
The thread contains some initial analysis of the problem but no solution, yet.
Comment 7 Jean-François El Fouly 2008-09-15 08:52:56 UTC
Created attachment 22574 [details]
Image dump in the PDF

Exactly what you would expect when reading the java code that generated the image.
Comment 8 Jean-François El Fouly 2008-09-15 08:54:21 UTC
Created attachment 22575 [details]
Soft mask dump from the PDF

Says in a rather straight manner that the thrid pixel is transparent and the rest is opaque; which is also what one would expect when reading the java source or looking at the PNG file at the bit level.
Comment 9 Jean-François El Fouly 2008-09-16 00:42:28 UTC
Created attachment 22587 [details]
Test case with changing background

Reading the chapter 7 (Transparency) of PDF 1.4 specification, I understood transparency is much about blending. So I tried the render with different color backgrounds but there seems to be no influence...
Comment 10 Jean-François El Fouly 2008-09-16 00:43:01 UTC
Created attachment 22588 [details]
PDF render with different backgrounds.
Comment 11 Jean-François El Fouly 2008-09-16 00:48:01 UTC
Also discussed previously (by the same):
http://markmail.org/message/gjrau3dfjmyfhne4
Comment 12 Jean-François El Fouly 2008-10-12 16:26:09 UTC
Playing with the AIS (Alpha Is Shape) parameter in the Graphics state does not fix the problem.
Comment 13 Jean-François El Fouly 2008-10-12 16:27:19 UTC
Created attachment 22715 [details]
Same test case, FOP patched to add /AIS false
Comment 14 Jean-François El Fouly 2008-10-12 16:27:56 UTC
Created attachment 22716 [details]
Same test case, FOP patched to add /AIS true
Comment 15 Luis Bernardo 2012-03-06 09:43:46 UTC
The dull colors are visible in Adobe Reader but not in Evince! Could the issue be with the viewer?
Comment 16 Glenn Adams 2012-04-07 01:41:30 UTC
resetting P2 open bugs to P3 pending further review