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

Tilman Hausherr commented on PDFBOX-2917:
-----------------------------------------

I did some more tests:
- changing the two /GS objects to contain nothing: bad rendering
- change the colorspace of /X36 to /DeviceCMYK instead of icc: OK rendering
So it is something only related to the image and its colorspace.

I looked where the ICC profile is used, which is PDColorSpace.toRGBImageAWT(), 
and changed this:
{code}
ColorConvertOp op = new ColorConvertOp(null);
op.filter(src, dest);
{code}
to this "simple" method:
{code}
for (int x = 0; x < raster.getWidth(); ++x)
    for (int y = 0; y < raster.getHeight(); ++y)
        dest.setRGB(x, y, src.getRGB(x, y));
{code}
or this
{code}
Graphics g = dest.getGraphics();
g.drawImage(src, 0, 0, null);
g.dispose();
{code}
and now the file renders properly. I then ran all the tests, there are many 
slight changes. I looked closely at PDFBOX-2128-PORSCHE_CMYK.pdf, the car 
images look slightly nicer with the "simple" convert method. The old rendering 
has the images slightly too light. Another: for the file bugzilla867751.pdf, 
the old version has two large rectangles on page 1 (best seen at the bottom 
right), which cannot be seen in the new version, i.e. the version with the 
simple conversion is better.

> PDF to Image, faint/dim Images
> ------------------------------
>
>                 Key: PDFBOX-2917
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2917
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.0
>         Environment: Windows 8.1, jdk1.8.0_51, jre1.8.0_51
>            Reporter: Samuil Goranov
>            Priority: Trivial
>              Labels: images, newbie
>         Attachments: saved0.png, selection.pdf
>
>
> {code:title=pdftoimage.java|borderStyle=solid}
> PDDocument document = null;
>         File file = new File("F:\\Projects\\java\\pdfbox\\complete.pdf");
>         document = PDDocument.load( file );
>         try {
>             // retrieve image
>             BufferedImage bi = new PDFRenderer(document).renderImageWithDPI( 
> 0 , 150, ImageType.RGB );
>             File outputfile = new File("saved0.png");
>             ImageIO.write(bi, "png", outputfile);
>         } catch (IOException e) {
>         }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to