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

[jira] [Closed] (PDFBOX-2041) Convert PDF to Image (Strange Color)

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

Tilman Hausherr closed PDFBOX-2041.
-----------------------------------

    Resolution: Cannot Reproduce

This means that the problem can only be in ImageIOUtil.writeImage(). There, either in java ImageIO (then we can't fix it), or in ImageIOUtil (then try again with 1.8.5 when it is released or from the snapshot directory
https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox/1.8.5-SNAPSHOT/ because I made some improvements there).

However this isn't important, because using PNG is much better for images with sharp edges, and it is much smaller (my 300dpi PNG file is 10% of the size of your JPG). If all your images are drawings like that, I'd recommend not to use BufferedImage.TYPE_INT_RGB, rather use BufferedImage.TYPE_BINARY and save it as a TIFF. (The upcoming 1.8.5 version will create very small images by using CCITT G4 compression). 

(It might be helpful telling us what kind of application you're developing, if this info isn't confidential. If you're doing a web application, then you can't use TIFF, obviously)

So I am closing this as "can't reproduce", but you're welcome to reopen this issue if you need JPEG and it still doesn't work with 1.8.5 and the latest version of JDK7. I would then try to set up an Ubuntu live system to see what happens. I am also thankful that your PDF helped us find an unrelated bug :-)

> Convert PDF to Image (Strange Color)
> ------------------------------------
>
>                 Key: PDFBOX-2041
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2041
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 1.8.4
>         Environment: Java(1.7.0_45),   OS (Ubuntu) 
>            Reporter: ahfei
>         Attachments: PDFBOX-2041.pdf, PDFBOX-2041.pdf-1-bad.tif, pdfbox-2041.pdf-1-good.png
>
>
> Using PDFBox, tried to convert PDF to Image file  (case1.pdf, case1.jpg)
> Below is code i'm using : 
> BufferedImage image = page.convertToImage(BufferedImage.TYPE_INT_RGB, 200);    
> ImageIOUtil.writeImage(image, "jpg", imagePath, BufferedImage.TYPE_INT_RGB, 200);
> After convert, this image isn't look like pdf. Half page of it become blue and black color. 
> Attached images & PDF : https://www.dropbox.com/sh/jevegc8bh09km1o/5XkVwPUxri 



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