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

Jakob Pyttlik updated PDFBOX-2853:
----------------------------------
    Description: 
CCITT-Images with colorspace different from PDIndexed are created using 
PDCCitt.java/getRGBImage:

{code}
 if (colorspace instanceof PDIndexed)
        {
           ...
        }
        else
        {
            byte[] map = new byte[] { (byte) 0x00, (byte) 0xFF };
            colorModel = new IndexColorModel(1, map.length, map, map, map, 
Transparency.OPAQUE);
        }
{code}

The value Transparency.OPAQUE (=1) is provided for the parameter 
"transparentIndex" - this creates an image, in which the white color is treated 
as transparent.

This bug is especially annoying for some OCR-documents I had to work with 
(using PageDrawer). They consist of rendered text (as result of the OCR), that 
has the original content as image rendered on top, fully covering the text. 
When the white background is rendered as transparent, the rendered page gets 
messed up, because both texts can be seen,

*Proposed Fix/Patch*
Replace the value *Transparency.OPAQUE* with *-1*, so that no color is 
transparent.

  was:
CCITT-Images with colorspace different from PDIndexed are created using 
getRGBImage

{code}
 if (colorspace instanceof PDIndexed)
        {
           ...
        }
        else
        {
            byte[] map = new byte[] { (byte) 0x00, (byte) 0xFF };
            colorModel = new IndexColorModel(1, map.length, map, map, map, 
Transparency.OPAQUE);
        }
{code}

The value Transparency.OPAQUE (=1) is provided for the parameter 
"transparentIndex" - this creates an image, in which the white color is treated 
as transparent.

This bug is especially annoying for some OCR-documents I had to work with 
(using PageDrawer). They consist of rendered text (as result of the OCR), that 
has the original content as image rendered on top, fully covering the text. 
When the white background is rendered as transparent, the rendered page gets 
messed up, because both texts can be seen,

*Proposed Fix/Patch*
Replace the value *Transparency.OPAQUE* with *-1*, so that no color is 
transparent.


> CCITT: Background is rendered as transparent color
> --------------------------------------------------
>
>                 Key: PDFBOX-2853
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2853
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 1.8.9
>            Reporter: Jakob Pyttlik
>              Labels: easyfix
>         Attachments: ccittbug.png
>
>
> CCITT-Images with colorspace different from PDIndexed are created using 
> PDCCitt.java/getRGBImage:
> {code}
>  if (colorspace instanceof PDIndexed)
>         {
>            ...
>         }
>         else
>         {
>             byte[] map = new byte[] { (byte) 0x00, (byte) 0xFF };
>             colorModel = new IndexColorModel(1, map.length, map, map, map, 
> Transparency.OPAQUE);
>         }
> {code}
> The value Transparency.OPAQUE (=1) is provided for the parameter 
> "transparentIndex" - this creates an image, in which the white color is 
> treated as transparent.
> This bug is especially annoying for some OCR-documents I had to work with 
> (using PageDrawer). They consist of rendered text (as result of the OCR), 
> that has the original content as image rendered on top, fully covering the 
> text. When the white background is rendered as transparent, the rendered page 
> gets messed up, because both texts can be seen,
> *Proposed Fix/Patch*
> Replace the value *Transparency.OPAQUE* with *-1*, so that no color is 
> transparent.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to