Harry Dent created PDFBOX-4205:
----------------------------------

             Summary: LosslessFactory alters image
                 Key: PDFBOX-4205
                 URL: https://issues.apache.org/jira/browse/PDFBOX-4205
             Project: PDFBox
          Issue Type: Bug
    Affects Versions: 2.0.9, 2.0.8, 2.0.7
         Environment: Ubuntu 16.04
            Reporter: Harry Dent
         Attachments: lossy.png, picture_of_text.png

The attached grayscale png becomes lighter when run through the following code 
snippet:

 
{code:java}
BufferedImage image = ImageIO.read(new File("picture_of_text.png"));

PDImageXObject xObject = LosslessFactory.createFromImage(new PDDocument(), 
image);
BufferedImage lossy = xObject.getImage();

ImageIO.write(lossy, "png", new File("lossy.png"));
{code}
The difference is most easy to spot by looking at the "S" in "41st". The loss 
in quality occurs in {{createFromImage()}} (rather than {{getImage()}}), which 
can be shown by embedding the {{PDImageXObject}} into a {{PDDocument}} and then 
saving this document to a file. 

 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to