From ddd3db877c7d489b3173087b3a5c5987b24f2d62 Mon Sep 17 00:00:00 2001 From: Allen95Wei Date: Sun, 10 Nov 2024 23:40:25 +0800 Subject: [PATCH] refactor: Black Signed-off-by: Allen95Wei --- thumbnail_generator.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/thumbnail_generator.py b/thumbnail_generator.py index 84aae07..ace4b9d 100644 --- a/thumbnail_generator.py +++ b/thumbnail_generator.py @@ -38,12 +38,13 @@ def write_title(self, title: str, color: int = None): for f in self.image_sources: img = Image.open(f) upscale_ratio = 1920 / img.width - img = img.resize((int(img.width * upscale_ratio), int(img.height * upscale_ratio)), Image.Resampling.BOX) + img = img.resize( + (int(img.width * upscale_ratio), int(img.height * upscale_ratio)), + Image.Resampling.BOX, + ) canva = ImageDraw.Draw(img) font_size = img.height * 0.18 - font = ImageFont.truetype( - "Iansui-Regular.ttf", font_size - ) + font = ImageFont.truetype("Iansui-Regular.ttf", font_size) canva.text( xy=(img.width / 2, img.height - font_size * 0.5), text=title, @@ -52,7 +53,7 @@ def write_title(self, title: str, color: int = None): anchor="mb", align="center", stroke_width=int(font_size * 0.05), - stroke_fill=(255, 255, 255) + stroke_fill=(255, 255, 255), ) img.save("test2.jpg") img.close()