From 2a7b1ce405a7a75c508feaf7c85c23e62ba6d475 Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Sun, 5 Nov 2023 11:17:37 +0200 Subject: [PATCH] Fix text drawing for new pillow --- nodes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nodes.py b/nodes.py index 915f8d1..09cccd3 100644 --- a/nodes.py +++ b/nodes.py @@ -453,7 +453,8 @@ class CreateTextMask: image = Image.new("RGB", (width, height), "black") draw = ImageDraw.Draw(image) font = ImageFont.truetype(font_path, font_size) - text_width, text_height = draw.textsize(text, font=font) + text_width = font.getlength(text) + text_height = font_size text_center_x = text_x + text_width / 2 text_center_y = text_y + text_height / 2 draw.text((text_x, text_y), text, font=font, fill=font_color)