mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-10 01:55:41 -04:00
Improve image quality of PNGs
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.
This commit is contained in:
@@ -264,7 +264,8 @@ def get_template(
|
|||||||
def png_from_pdf(pdf_endpoint):
|
def png_from_pdf(pdf_endpoint):
|
||||||
output = BytesIO()
|
output = BytesIO()
|
||||||
with Image(
|
with Image(
|
||||||
blob=pdf_endpoint.get_data()
|
blob=pdf_endpoint.get_data(),
|
||||||
|
resolution=96,
|
||||||
) as image:
|
) as image:
|
||||||
with image.convert('png') as converted:
|
with image.convert('png') as converted:
|
||||||
converted.save(file=output)
|
converted.save(file=output)
|
||||||
|
|||||||
Reference in New Issue
Block a user