You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Jimi Hullegård (Updated JIRA)" <ji...@apache.org> on 2012/02/06 17:47:59 UTC

[jira] [Updated] (PDFBOX-1223) Strange color issues with convertToImage method

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

Jimi Hullegård updated PDFBOX-1223:
-----------------------------------

    Attachment: case4.png
                case3.png
                case2.png
                case1.png
                case3.pdf
                case2.pdf
                case1.pdf

Note that case4.pdf was to big for an attachment. It can be downloaded here: 

www.svensktnaringsliv.se/multimedia/archive/00007/I_praktiken_-_f_retag_7717a.pdf
                
> Strange color issues with convertToImage method
> -----------------------------------------------
>
>                 Key: PDFBOX-1223
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1223
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 1.6.0
>            Reporter: Jimi Hullegård
>              Labels: colorspaces, convertToImage, rendering, transparent
>         Attachments: case1.pdf, case1.png, case2.pdf, case2.png, case3.pdf, case3.png, case4.png
>
>
> While testing PDFBox I noticed a few strange color issues when converting the first page of an pdf to an image using the method convertToImage on a PDPage. An example pdf and resulting png is attached for each case.
> - Case 1: Most of the colors seem to get inverted.
> - Case 2: The green color of the area in the top right is paler the the original, and the text under the logo at the bottom right is quite "pixely"
> - Case 3: The blue area under the text is missing
> - Case 4: The red area should be semi-transparent (so the rose stem can be seen behind it), not solid.
> I compared all resulting images with how the pdf looks in Foxit Reader 5.1 on Windows 7.
> This is the code I used:
> ---------
> PDFParser parser = new PDFParser(new FileInputStream(pdfInputFile));
> parser.parse();
> PDDocument document = parser.getPDDocument();
> List<PDPage> pages = (List<PDPage>)document.getDocumentCatalog().getAllPages();
> if (pages.size() > 0) {
> 	PDPage page = pages.get(0);
> 	BufferedImage image = page.convertToImage(BufferedImage.TYPE_INT_RGB, 300);		
> 	ImageIO.write(image, "png", pngOutputFile);
> }
> ---------
> If there is some change I can do in my code or some configuration to improve some of these issues, then I would love to hear about it. As a comparison, Ghost4j (with Ghostscript underneath) can handle these cases better. Even the text under the logo in case 2 was less "pixely", with the same resolution.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira