You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Constantine Dokolas (Jira)" <ji...@apache.org> on 2020/03/03 08:45:00 UTC

[jira] [Comment Edited] (PDFBOX-4205) LosslessFactory alters image

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

Constantine Dokolas edited comment on PDFBOX-4205 at 3/3/20 8:44 AM:
---------------------------------------------------------------------

JIRA decided to cancel the changes to my comment when switching from "Visual" mode to "Text" mode and I lost all my precious elucidations. :P This is a summary:

The test should be done only by loading a grayscale image, which correctly creates the linear grayscale colorspace; not via pseudo-conversion, which uses sRGB colorspace throughout. The problem will be how to determine what the "reference" data are. The objective is that the byte values should be preserved all the way to the XObject stream.

It may still be that the specific test shows some bug appearing. I will check later. It may be that the colorspace should be also considered...


was (Author: cdokolas):
JIRA decided to cancel the changes to my comment when switching from "Visual" mode to "Text" mode and I lost all my precious elucidations. :P This is a summary:

The test should be done only by loading a grayscale image, which correctly creates the linear grayscale colorspace; not via pseudo-conversion, which uses sRGB colorspace throughout.

It may still be that the specific test shows some bug appearing. I will check later. It may be that the colorspace should be also considered...

> LosslessFactory alters image
> ----------------------------
>
>                 Key: PDFBOX-4205
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4205
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.7, 2.0.8, 2.0.9
>         Environment: Ubuntu 16.04
>            Reporter: Harry Dent
>            Priority: Minor
>         Attachments: image-2020-02-24-17-59-08-300.png, 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 easiest 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
(v8.3.4#803005)

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