Can you check whether FOP-1575 is the same problem?

Is getEffectiveICCProfile() only called if there is no embedded profile? Could there be cases where that profile is in fact correct?

On 1/12/16 9:25 PM, Matthias Reischenbacher wrote:
Hi,

I've been struggling today with the PDF display of a PNG with "gray"
color space. When using the default PNG loader (with the raw PNG loader
all works fine), the colors are displayed very "light" and "dull".
During a debug session I found out that the ImageIO loader assigns a
default Gray ICC profile (of type java.awt.color.ICC_ProfileGray), if
the PNG file doesn't have an embedded ICC profile. So the
ImageRenderedAdapter.getEffectiveICCProfile method returns this Java
"ICC_ProfileGray" profile, which is then embedded in the output PDF.
Displaying the PNG with this profile, causes the "incorrect" color display.
I'm aware that an ICC profile should be embedded in the PNG file, in
order to have full control over color reproduction, but I'm wondering if
it doesn't go a bit too far to output a profile, which is internally
assigned by the JRE. As a quick fix I locally changed the
ImageRenderedAdapter.getEffectiveICCProfile method the following way:

protected ICC_Profile getEffectiveICCProfile() {
     ColorSpace cs = getImageColorSpace();
     if (cs instanceof ICC_ColorSpace) {
         ICC_ColorSpace iccSpace = (ICC_ColorSpace)cs;
         return !(iccSpace.getProfile() instanceof ICC_ProfileGray) ?
iccSpace.getProfile() : null;
     } else {
         return null;
     }
}

Please let me know, if anybody disagrees with this approach or if it
should be handled somewhere else.

Thanks,
Matthias


Reply via email to