From 220673484a6dc27469656ee32f087d920c170921 Mon Sep 17 00:00:00 2001 From: recanman <29310982+recanman@users.noreply.github.com> Date: Sat, 31 Aug 2024 21:02:45 -0700 Subject: [PATCH] feat: compress cover image --- new_issue.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/new_issue.py b/new_issue.py index eb61d93..cd30470 100755 --- a/new_issue.py +++ b/new_issue.py @@ -6,7 +6,7 @@ import argparse import datetime import tempfile import tomllib - +from PIL import Image def get_period_string( start: datetime.datetime, @@ -124,6 +124,9 @@ def create_issue_image( ] ) + image = Image.open(f"content/weekly/issue-{issue_number}/cover.png") + image = image.convert("RGB").quantize(colors=256) + image.save(f"content/weekly/issue-{issue_number}/cover.png", "PNG", compress_level=9) def get_latest_issue() -> int: """Get the latest issue number from the weekly directory