Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poor image rendering quality #63

Open
pratheesh-prakash opened this issue Jul 21, 2022 · 1 comment
Open

Poor image rendering quality #63

pratheesh-prakash opened this issue Jul 21, 2022 · 1 comment

Comments

@pratheesh-prakash
Copy link

Hello @cbrunet . Excellent tool. This is one of the fastest ways to generate PDF images. Thanks for building this.

I have tried python-poppler to render a PDF page, following the documentation available at https://cbrunet.net/python-poppler/usage.html. I have used the following code.

import poppler

doc = poppler.load_from_file(PDF_PATH)
renderer = poppler.PageRenderer()

page = doc.create_page(54)
image = renderer.render_page(page, xres=300, yres=300)
image.save('test.png', 'png', dpi=300)

However, the resultant image has poor rendering, compared to the ones generated using pdftocairo. I am assuming that it is an issue with hinting. I am attaching sample images for your perusal. Zoom in to each of the file to see the difference. The font edges are corrugated in case of python-poppler generated image.

pdftocairo
python_poppler

@bzamecnik
Copy link
Contributor

@pratheesh-prakash You'll probably need to enable antialiasing:

renderer = poppler.PageRenderer()
renderer.set_render_hint(poppler.RenderHint.text_antialiasing)
image = renderer.render_page( page, xres=300, yres=300)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants