[ 
https://issues.apache.org/jira/browse/PDFBOX-6260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18117280#comment-18117280
 ] 

valery edited comment on PDFBOX-6260 at 9/20/26 12:13 PM:
----------------------------------------------------------

Hi, [~tilman].

A follow-up question about PDCalGray, related to the chromatic adaptation added 
here. No bug is confirmed; I only want to know whether one exists.

PDCalGray.toRGB() calibrates only when the whitepoint is exactly (1 1 1).
For any other whitepoint it skips the calibration and returns
{value[0], value[0], value[0]}, so gamma is ignored:

    if (isWhitePoint())   // only (1,1,1)
        ... convXYZtoRGB(powAG, powAG, powAG)
    else
        return new float[] { value[0], value[0], value[0] };

This looks like the workaround from PDFBOX-2971 ("treat CalGray like CalRGB"). 
The reporter there diagnosed the missing D50 adaptation, which PDFBOX-6260 has 
now added. I did a numeric check of calibrated + adapted CalGray against the 
skip, as 8-bit gray:

  - the whitepoint no longer matters, because it cancels out in the adaptation; 
only gamma matters
  - gamma 2.2: at most 7/255 different from the skip (mostly dark tones, e.g. 
value 0.1 gives 19 vs 26), so PDFBOX-2971's D65 / gamma 2.2 file looks fine 
either way
  - gamma 1.0: up to 73/255 different; gamma 1.8: up to 18; gamma 3.0: up to 30

So the skip should only be visible for a CalGray with a whitepoint other than 
(1 1 1) and a gamma clearly different from 2.2. I searched the test corpus, 
JIRA and the pdf.js test files. I only found CalGray with D65 / 2.2 
(PDFBOX-2971) and with (1 1 1) (PDFBOX-4119, 1724, 4750, and pdf.js calgray.pdf 
with gamma 1.0 and 5.0). I found no file that renders wrongly.

Two questions:
1. Do you have (or know of) a file with a CalGray that has a non-(1 1 1) 
whitepoint and a gamma other than 2.2 and renders wrongly (compared with 
Acrobat)? A link would let me test.
2. If not, is the skip still needed for CalGray?If a proper fix is wanted, it 
would calibrate always, using (wpX*Y, wpY*Y, wpZ*Y) as XYZ instead of (Y, Y, 
Y), which is only correct for whitepoint (1 1 1) today.


was (Author: vbokov):
Hi, [~tilman].

A follow-up question about PDCalGray, related to the chromatic adaptation added 
here. No bug is confirmed; I only want to know whether one exists.

PDCalGray.toRGB() calibrates only when the whitepoint is exactly (1 1 1).
For any other whitepoint it skips the calibration and returns
{value[0], value[0], value[0]}, so gamma is ignored:
'''
    if (isWhitePoint())   // only (1,1,1)
        ... convXYZtoRGB(powAG, powAG, powAG)
    else
        return new float[] { value[0], value[0], value[0] };
'''
This looks like the workaround from PDFBOX-2971 ("treat CalGray like CalRGB"). 
The reporter there diagnosed the missing D50 adaptation, which PDFBOX-6260 has 
now added. I did a numeric check of calibrated + adapted CalGray against the 
skip, as 8-bit gray:

  - the whitepoint no longer matters, because it cancels out in the adaptation; 
only gamma matters
  - gamma 2.2: at most 7/255 different from the skip (mostly dark tones, e.g. 
value 0.1 gives 19 vs 26), so PDFBOX-2971's D65 / gamma 2.2 file looks fine 
either way
  - gamma 1.0: up to 73/255 different; gamma 1.8: up to 18; gamma 3.0: up to 30

So the skip should only be visible for a CalGray with a whitepoint other than 
(1 1 1) and a gamma clearly different from 2.2. I searched the test corpus, 
JIRA and the pdf.js test files. I only found CalGray with D65 / 2.2 
(PDFBOX-2971) and with (1 1 1) (PDFBOX-4119, 1724, 4750, and pdf.js calgray.pdf 
with gamma 1.0 and 5.0). I found no file that renders wrongly.

Two questions:
1. Do you have (or know of) a file with a CalGray that has a non-(1 1 1) 
whitepoint and a gamma other than 2.2 and renders wrongly (compared with 
Acrobat)? A link would let me test.
2. If not, is the skip still needed for CalGray?If a proper fix is wanted, it 
would calibrate always, using (wpX*Y, wpY*Y, wpZ*Y) as XYZ instead of (Y, Y, 
Y), which is only correct for whitepoint (1 1 1) today.

> CalRGB color regression
> -----------------------
>
>                 Key: PDFBOX-6260
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-6260
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.37, 3.0.8 PDFBox
>            Reporter: Tilman Hausherr
>            Assignee: Tilman Hausherr
>            Priority: Minor
>              Labels: CalRGB
>             Fix For: 2.0.38, 3.0.9 PDFBox, 4.0.0
>
>         Attachments: PDCIEDictionaryBasedColorSpace.java, 
> gs-bugzilla686749-CalRGB-reduced.pdf
>
>
> This is about this "unrealistic" CalRGB file of this GS issue
> https://bugs.ghostscript.com/show_bug.cgi?id=686749
> Rendering has different colors since PDFBOX-5079.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to