fix: 🐛 support pillow < 10

It seems I did this after VLM nodes installed it.
This fix handle both cases.

closes #155
This commit is contained in:
Mel Massadian
2024-03-13 01:20:14 +01:00
parent 54ff6583de
commit 48f91b74e2
2 changed files with 8 additions and 2 deletions
+7 -1
View File
@@ -333,9 +333,15 @@ class TextToImage:
else: # bottom
y_text = (height - (line_height_px * len(lines))) - v_offset
def get_width(line):
if hasattr(font, "getsize"):
return font.getsize(line)[0]
else:
return font.getlength(line)
# Draw each line of text
for line in lines:
line_width = font.getlength(line)
line_width = get_width(line)
# Horizontal alignment
if h_align == "left":
x_text = h_offset
+1 -1
View File
@@ -7,4 +7,4 @@ imageio_ffmpeg
rich
rich_argparse
matplotlib
pillow>=10
pillow