You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (JIRA)" <ji...@apache.org> on 2011/05/30 18:43:47 UTC

[jira] [Closed] (PDFBOX-1022) PDPage convertToImage creates inverted black and white image for indexed colorspace.

     [ https://issues.apache.org/jira/browse/PDFBOX-1022?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler closed PDFBOX-1022.
--------------------------------------

    Resolution: Duplicate
      Assignee: Andreas Lehmkühler

> PDPage convertToImage creates inverted black and white image for indexed colorspace.
> ------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-1022
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1022
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 1.5.0
>         Environment: Java 1.6, Windows 7.
>            Reporter: Roland Quast
>            Assignee: Andreas Lehmkühler
>            Priority: Critical
>         Attachments: tast_bb.pdf
>
>
> The attached PDF file demonstrates that line 178 of PDPixelMap.java does not try to determine what is the black value and what is the white value. The colorspace of the attached PDF file is PDIndexed.
> Inverting this value makes the file render correctly, but there needs to be some kind of way to determine what is black/white for a PDIndexed colorspace.
>                 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 if (colorspace instanceof PDICCBased)
>                 {
>                     if ( ((PDICCBased)colorspace).getNumberOfComponents() == 1) 
>                     {
>                         map = new byte[] {(byte)0xff};
>                     }
>                     else
>                     {
>                         map = new byte[] {(byte)0x00, (byte)0xff};
>                     }
>                 }
>                 else
>                 {
>                     map = new byte[] {(byte)0x00, (byte)0xff}; // <--- HAPPENS HERE - NO TEST FOR BLACK/WHITE LIKE OTHER CASES ABOVE.
>                 }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira