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

Timo Boehme updated PDFBOX-825:
-------------------------------

    Description: 
In class PDPixelMap used to decode images the handling of opacity for images 
with color space PDIndexed is wrong.

Test PDF: http://onlinelibrary.wiley.com/doi/10.1002/ajh.21765/pdf
(or another PDF with image and color space /Indexed)

Picture Im2 at page 4 of the test PDF is empty (all pixels white).

The reason:
In PDPixelMap at line 205 (rev. 988513) an opacity variable is set depending on 
first value of Decode parameter.
This parameter often is not specified (null) and default value is [0, 2^n-1].  
Thus the code:
boolean isOpaque = (decode != null && decode.getInt(0) == 1) ? true : false;
sets isOpaque to false, resulting in all white pixel.
Exchanging 'true' and 'false' would help but I even can't imagine why a first 
value of '1' should
be interpreted as an opacity parameter? Am I missing something (some kind of 
workaround)?

If there are no good reasons for keeping the opaque parameter I would propose 
removing it and setting alpha to 0xff in every case.

  was:
In class PDPixelMap used to decode images the handling of opacity for images 
with color space PDIndexed is wrong.

Test PDF: 
http://onlinelibrary.wiley.com/store/10.1002/ajh.21765/asset/21765_ftp.pdf?v=1&t=gdwynpue&s=fefe3043eabbda71a925cb024b1e9731ea92a9b8
(or another PDF with image and color space /Indexed)

Picture Im2 at page 4 of the test PDF is empty (all pixels white).

The reason:
In PDPixelMap at line 205 (rev. 988513) an opacity variable is set depending on 
first value of Decode parameter.
This parameter often is not specified (null) and default value is [0, 2^n-1].  
Thus the code:
boolean isOpaque = (decode != null && decode.getInt(0) == 1) ? true : false;
sets isOpaque to false, resulting in all white pixel.
Exchanging 'true' and 'false' would help but I even can't imagine why a first 
value of '1' should
be interpreted as an opacity parameter? Am I missing something (some kind of 
workaround)?

If there are no good reasons for keeping the opaque parameter I would propose 
removing it and setting alpha to 0xff in every case.


example PDF link did not work

> Wrong opacity for images with indexed color space 
> --------------------------------------------------
>
>                 Key: PDFBOX-825
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-825
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Parsing
>    Affects Versions: 1.3.0
>            Reporter: Timo Boehme
>   Original Estimate: 0.25h
>  Remaining Estimate: 0.25h
>
> In class PDPixelMap used to decode images the handling of opacity for images 
> with color space PDIndexed is wrong.
> Test PDF: http://onlinelibrary.wiley.com/doi/10.1002/ajh.21765/pdf
> (or another PDF with image and color space /Indexed)
> Picture Im2 at page 4 of the test PDF is empty (all pixels white).
> The reason:
> In PDPixelMap at line 205 (rev. 988513) an opacity variable is set depending 
> on first value of Decode parameter.
> This parameter often is not specified (null) and default value is [0, 2^n-1]. 
>  Thus the code:
> boolean isOpaque = (decode != null && decode.getInt(0) == 1) ? true : false;
> sets isOpaque to false, resulting in all white pixel.
> Exchanging 'true' and 'false' would help but I even can't imagine why a first 
> value of '1' should
> be interpreted as an opacity parameter? Am I missing something (some kind of 
> workaround)?
> If there are no good reasons for keeping the opaque parameter I would propose 
> removing it and setting alpha to 0xff in every case.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to