You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Elija B (JIRA)" <ji...@apache.org> on 2014/04/16 05:25:15 UTC

[jira] [Updated] (PDFBOX-2031) GrayScale images become inverted

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

Elija B updated PDFBOX-2031:
----------------------------

    Description: 
PDPixelMap.getRGBImage() inverts images. After debugging it appears that the inversion happens at the end, in applyMasks(image);

Some more debugging info:
bitsPerComponent == 1
getImageMask() == true
getColorSpace() == PDDeviceGray

map == new byte[] {(byte)0xff} // used for IndexColorModel

In imageMask(baseImage) this happens:

graphics.setColor(Color.BLACK);
graphics.fillRect(0, 0, baseImage.getWidth(), baseImage.getHeight());
        // assume default values ([0,1]) for the DecodeArray
        // TODO DecodeArray == [1,0]
        graphics.setComposite(AlphaComposite.DstIn);
        graphics.drawImage(baseImage, null, 0, 0);
        graphics.dispose();
        return stencilMask;

I wish I could provide a sample file, but I have no sanitized data files. 

  was:
PDPixelMap.getRGBImage() inverts images. After debugging it appears that the inversion happens at the end, in applyMasks(image);

Some more debugging info:
bitsPerComponent == 1
getImageMask() == true
getColorSpace() == PDDeviceGray

map == new byte[] {(byte)0xff} // used for IndexColorModel

In imageMask(baseImage) this happens:

graphics.setColor(Color.BLACK);
graphics.fillRect(0, 0, baseImage.getWidth(), baseImage.getHeight());
        // assume default values ([0,1]) for the DecodeArray
        // TODO DecodeArray == [1,0]
        graphics.setComposite(AlphaComposite.DstIn);
        graphics.drawImage(baseImage, null, 0, 0);
        graphics.dispose();
        return stencilMask;


> GrayScale images become inverted
> --------------------------------
>
>                 Key: PDFBOX-2031
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2031
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 1.8.4
>         Environment: osx
>            Reporter: Elija B
>
> PDPixelMap.getRGBImage() inverts images. After debugging it appears that the inversion happens at the end, in applyMasks(image);
> Some more debugging info:
> bitsPerComponent == 1
> getImageMask() == true
> getColorSpace() == PDDeviceGray
> map == new byte[] {(byte)0xff} // used for IndexColorModel
> In imageMask(baseImage) this happens:
> graphics.setColor(Color.BLACK);
> graphics.fillRect(0, 0, baseImage.getWidth(), baseImage.getHeight());
>         // assume default values ([0,1]) for the DecodeArray
>         // TODO DecodeArray == [1,0]
>         graphics.setComposite(AlphaComposite.DstIn);
>         graphics.drawImage(baseImage, null, 0, 0);
>         graphics.dispose();
>         return stencilMask;
> I wish I could provide a sample file, but I have no sanitized data files. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)