Skip to content

Commit

Permalink
refactor: Black
Browse files Browse the repository at this point in the history
Signed-off-by: Allen95Wei <[email protected]>
  • Loading branch information
Alllen95Wei committed Nov 10, 2024
1 parent d97f730 commit ddd3db8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions thumbnail_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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()
Expand Down

0 comments on commit ddd3db8

Please sign in to comment.