You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "John Hewson (JIRA)" <ji...@apache.org> on 2014/11/14 19:57:34 UTC

[jira] [Closed] (PDFBOX-2496) PNG filesize is larger

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

John Hewson closed PDFBOX-2496.
-------------------------------
    Resolution: Not a Problem

We have RELEASE-NOTES.txt which is updated when a release is made, based on the titles of the resolved issues on JIRA. You can find [all 379 of them here|https://issues.apache.org/jira/issues/?jql=project%20%3D%20PDFBOX%20AND%20status%20%3D%20Resolved%20AND%20fixVersion%20%3D%202.0.0].

The increased PNG file size is due to the larger number of colors in the 2.0 image due to the improved image interpolation and anti-aliasing of the vector graphics and text. So it's a side-effect of the fact that 2.0 is doing higher quality rendering.

If you want to produce smaller images then what you want to do is not to alter the RenderingHints but to reduce the colour depth of the generated image, this is known as "color quantization". Running the [pngquant|http://pngquant.org] tool on the version 2.0 PNG reduces it from 657KB to 175KB, which is under half the size of the original 1.8 PNG.

You might be able to do this in pure Java using this [Apache 2.0 Licensed code on stackoverflow|http://stackoverflow.com/questions/5041606/jh-labs-quantize-usage-to-reduce-image-color-depth] but it's not something I've tried.

> PNG filesize is larger
> ----------------------
>
>                 Key: PDFBOX-2496
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2496
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.0
>            Reporter: simon steiner
>             Fix For: 2.0.0
>
>         Attachments: 18simple1.png, 20simple1.png, simple.pdf
>
>
> java -jar ~/pdf-box-svn/app/target/pdfbox-app-2.0.0-SNAPSHOT.jar PDFToImage -format png simple.pdf
> java -jar pdfbox/app/target/pdfbox-app-1.8.8-SNAPSHOT.jar PDFToImage -imageType png simple.pdf
> 2.0 is 656KB
> 1.8 is 402KB



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