From 729568d010a0f6e9f44eaf6cacf8f824289c00d4 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Wed, 28 Dec 2016 11:07:22 +0000 Subject: [PATCH] Improve image quality of PNGs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The PNGs we were generating looked a bit fuzzy, and the text rendering was a bit off. This is because we weren’t rendering them at a high enough resolution. I’m guessing the default was 72dpi. This commit increases the resolution to 96dpi, which (locally) seems to be enough to give a good-looking preview. --- app/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/utils.py b/app/utils.py index 50dc1df0c..ac91c0f93 100644 --- a/app/utils.py +++ b/app/utils.py @@ -264,7 +264,8 @@ def get_template( def png_from_pdf(pdf_endpoint): output = BytesIO() with Image( - blob=pdf_endpoint.get_data() + blob=pdf_endpoint.get_data(), + resolution=96, ) as image: with image.convert('png') as converted: converted.save(file=output)