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 2018/12/03 12:35:00 UTC
[jira] [Commented] (PDFBOX-4391) Page to image rendering in pdfbox
2.0: Poor quality compared to 1.8
[ https://issues.apache.org/jira/browse/PDFBOX-4391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16707124#comment-16707124 ]
Tilman Hausherr commented on PDFBOX-4391:
-----------------------------------------
It is the antialiasing.
> Page to image rendering in pdfbox 2.0: Poor quality compared to 1.8
> -------------------------------------------------------------------
>
> Key: PDFBOX-4391
> URL: https://issues.apache.org/jira/browse/PDFBOX-4391
> Project: PDFBox
> Issue Type: Bug
> Components: Rendering
> Affects Versions: 2.0.13
> Environment: Windows 10
> JDK 1.8.0_181
> Reporter: Olivier M
> Priority: Major
> Labels: image, quality, rendering
> Attachments: barcode-128.pdf, barcode-image-1.8.16.png, barcode-image-2.0.13.png, comparison.png
>
>
> I have a process that needs to convert pages of pdf files to images to be able to detect barcodes.
> Since I've upgrade to pdfbox 2.0 my barcodes are not correctly detected anymore.
> I noticed the cause was the result of the page to image rendering implemented in pdfbox 2.0.
> The quality of the image is really poor compared to pdfbox 1.8.
> See the attached image (comparison.png):
> On the left you have the image generated with pdfbox 2.0.13
> On the right you have the image generated with pdfbox 1.8.16
> We can clearly see the difference.
> Both images were generated using the same resolution (200 dpi here):
> For 2.0.13:
> {code:java}
> BufferedImage image = pdfRenderer.renderImageWithDPI(0, 200, ImageType.BINARY);{code}
> For 1.8.16:
> {code:java}
> PDPage page = (PDPage) pdfDocument.getDocumentCatalog().getAllPages().get(0);
> BufferedImage image = page.convertToImage(BufferedImage.TYPE_BYTE_BINARY, 200);{code}
> Buffered images were both written to files using:
> {code:java}
> ImageIO.write(image, "png", file); {code}
> I've attached the pdf file (barcode-128.pdf) and the generated images (barcode-image-2.0.13.png and barcode-image.1.8.16.png)
>
>
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org