Skip to content

Commit

Permalink
fix: Pillow replace textsize by textlength
Browse files Browse the repository at this point in the history
  • Loading branch information
fabien-michel committed Jul 19, 2023
1 parent 4a985c6 commit c758e5a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions make_preview.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import multiprocessing
import os
from collections import defaultdict
from operator import itemgetter
from pathlib import Path

from PIL import Image, ImageDraw, ImageFont, ImageOps
from PIL import Image, ImageDraw, ImageFont

# Configure values
IMAGE_WIDTH = 1024
Expand Down Expand Up @@ -76,7 +75,7 @@ def make_category_preview(catalog_entries):
main_image.paste(image, (x, y))

# Draw the filename under the thumbnail
text_width, text_height = draw.textsize(entry["assetId"], font=font)
text_width = draw.textlength(entry["assetId"], font=font)
draw.text(
(
x + (THUMBNAIL_SIZE - text_width) / 2,
Expand Down

0 comments on commit c758e5a

Please sign in to comment.