You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Scott Tyriver (JIRA)" <ji...@apache.org> on 2009/12/16 16:45:18 UTC

[jira] Created: (PDFBOX-584) convertToImage seems to invert colors

convertToImage seems to invert colors
-------------------------------------

                 Key: PDFBOX-584
                 URL: https://issues.apache.org/jira/browse/PDFBOX-584
             Project: PDFBox
          Issue Type: Bug
          Components: Parsing
    Affects Versions: 0.8.0-incubator
         Environment: any
            Reporter: Scott Tyriver


The pdfbox support team asked me to post this message on this forum so attachments could be seen

I have a pdf document that has a white background with black text. It
appears after I make the call to convertToImage the colors are reversed. A
black background with white text

pdDocument = PDDocument.load(new ByteArrayInputStream(aContent));
List<PDPage> documentPageList = pdDocument.getDocumentCatalog().getAllPages();
for(int i=0; i<documentPageList.size(); ++i) {
PDPage aPage = documentPageList.get(i);
for (int x=1; x < 14; x++) {
BufferedImage tempImage = convertToImage(x, (2 * 72),aPage);
ImageIO.write(tempImage,"jpeg", new File("c:\\tmp
page-" + x + ".jpeg"));
}
} 


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


[jira] Updated: (PDFBOX-584) convertToImage seems to invert colors

Posted by "Scott Tyriver (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-584?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott Tyriver updated PDFBOX-584:
---------------------------------

    Attachment: page-8.png
                original.pdf

Original is the pdf we are attempting to convert
The page-8.png file is the out from convertToImage call

> convertToImage seems to invert colors
> -------------------------------------
>
>                 Key: PDFBOX-584
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-584
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Parsing
>    Affects Versions: 0.8.0-incubator
>         Environment: any
>            Reporter: Scott Tyriver
>         Attachments: original.pdf, page-8.png
>
>
> The pdfbox support team asked me to post this message on this forum so attachments could be seen
> I have a pdf document that has a white background with black text. It
> appears after I make the call to convertToImage the colors are reversed. A
> black background with white text
> pdDocument = PDDocument.load(new ByteArrayInputStream(aContent));
> List<PDPage> documentPageList = pdDocument.getDocumentCatalog().getAllPages();
> for(int i=0; i<documentPageList.size(); ++i) {
> PDPage aPage = documentPageList.get(i);
> for (int x=1; x < 14; x++) {
> BufferedImage tempImage = convertToImage(x, (2 * 72),aPage);
> ImageIO.write(tempImage,"jpeg", new File("c:\\tmp
> page-" + x + ".jpeg"));
> }
> } 

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


[jira] Commented: (PDFBOX-584) convertToImage seems to invert colors

Posted by "Mel Martinez (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PDFBOX-584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12791435#action_12791435 ] 

Mel Martinez commented on PDFBOX-584:
-------------------------------------

I've seen this same problem (reversed color tables) in numerous PDF files with JPEG and BMP images.  When I extract the images with the seqence:

PDPage page = ....
PDResources resources = page.getResources();
Map images = resources.getImages();
...
PDXObjectImage image = (PDXObjectImage)images.get(key);

writing out the image from this object results in an image with the colors inverted, as if looking at a color negative.

Interestingly, they generally are correct for straight black & white images.

I've tried various sequences for extracting the image from the PDXObjectImage object, but the result is always the same.

This is with 0.8.0 incubator.  


> convertToImage seems to invert colors
> -------------------------------------
>
>                 Key: PDFBOX-584
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-584
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Parsing
>    Affects Versions: 0.8.0-incubator
>         Environment: any
>            Reporter: Scott Tyriver
>         Attachments: original.pdf, page-8.png
>
>
> The pdfbox support team asked me to post this message on this forum so attachments could be seen
> I have a pdf document that has a white background with black text. It
> appears after I make the call to convertToImage the colors are reversed. A
> black background with white text
> pdDocument = PDDocument.load(new ByteArrayInputStream(aContent));
> List<PDPage> documentPageList = pdDocument.getDocumentCatalog().getAllPages();
> for(int i=0; i<documentPageList.size(); ++i) {
> PDPage aPage = documentPageList.get(i);
> for (int x=1; x < 14; x++) {
> BufferedImage tempImage = convertToImage(x, (2 * 72),aPage);
> ImageIO.write(tempImage,"jpeg", new File("c:\\tmp
> page-" + x + ".jpeg"));
> }
> } 

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