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

Tilman Hausherr commented on PDFBOX-5553:
-----------------------------------------

>From SampledImageReader.java:
{code}
final int invert = colorSpace instanceof PDIndexed || decode[0] < decode[1] ? 0 
: -1;
{code}
The image has both, it is indexed *and* has an "inverted" decode. So unless the 
specification sees this differently (I'll look tomorrow), we should invert 
twice, i.e. not invert at all.

> PDFRenderer resulting image has black background
> ------------------------------------------------
>
>                 Key: PDFBOX-5553
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5553
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.27
>            Reporter: Joseph Jezerinac
>            Priority: Major
>         Attachments: black-background.pdf
>
>
> Using the attached PDF as the pdf, the resulting png has a black ground using 
> the code below.  Opening this PDF in reader or chrome etc., the background is 
> white.
> {code:java}
> PDDocument pdDocument = PDDocument.load(pdf, 
> MemoryUsageSetting.setupMixed(1024 * 1024 * 56));
> try {    BufferedImage image = new 
> PDFRenderer(pdDocument).renderImageWithDPI(0, 300, ImageType.RGB);
>     ImageIO.write(image, "png", new File("bad-black-background.png"));
> } finally {
>     pdDocument.close();
> } {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to