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

Tilman Hausherr commented on PDFBOX-2435:
-----------------------------------------

The decode array is also used in PDPixelMap. However changing the handling like 
in PDCcitt has no effect on the rendering of 415 test files.  This code segment
{code}
            else if (bpc == 1)
            {
                byte[] map = null;
                if (colorspace instanceof PDDeviceGray)
                {
                    COSArray decode = getDecode();
                    // we have to invert the b/w-values,
                    // if the Decode array exists and consists of (1,0)
                    if (decode != null && decode.getInt(0) == 1)
                    {
                        map = new byte[] {(byte)0xff};
                    }
                    else
                    {
                        map = new byte[] {(byte)0x00, (byte)0xff};
                    }
                }
                else
                {
                    map = new byte[] {(byte)0x00, (byte)0xff};
                }
                cm = new IndexColorModel(bpc, map.length, map, map, map, 
Transparency.OPAQUE);
            }
{code}
does the same, regardless which map type is created. There is a comment in 
CCITTFaxFilter that IndexColorModel is unreliable.

Although a change apparently does no harm, I prefer to leave it as it is to 
avoid any surprise.

> ConvertToImage Appears To Invert Colors
> ---------------------------------------
>
>                 Key: PDFBOX-2435
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2435
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Writing
>    Affects Versions: 1.8.7, 1.8.8
>            Reporter: lufeng
>            Assignee: Tilman Hausherr
>              Labels: CCITTFaxDecode, regression
>             Fix For: 1.8.8
>
>         Attachments: 123.PDF, 123.png, screenshot-1.png
>
>
> the colors are reversed when I call convertToImage API in PDPage class.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to