From a7895f6114f797af2ae91b494daf7d6b5646df0b Mon Sep 17 00:00:00 2001 From: LonicaMewinsky <93007558+LonicaMewinsky@users.noreply.github.com> Date: Mon, 27 Nov 2023 08:47:18 -0600 Subject: [PATCH] fixed PIL textsize versus textlength --- makeframeutils.py | 7 +++---- nodes/MakeFrame.py | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/makeframeutils.py b/makeframeutils.py index 58e8db7..c354124 100644 --- a/makeframeutils.py +++ b/makeframeutils.py @@ -101,11 +101,10 @@ def ImgLabeler(img, text, size=72, color=(255,255,255)): draw = ImageDraw.Draw(img) # Get text size - text_size = draw.textsize(text, font=font) - + text_size = draw.textlength(text, font=font) # Calculate x, y coordinates of the text - x = (img.width - text_size[0]) / 2 - y = (img.height - text_size[1]) / 2 + x = (img.width - text_size) / 2 + y = (img.height - text_size) / 2 # Position for the text, centered text_position = (x, y) diff --git a/nodes/MakeFrame.py b/nodes/MakeFrame.py index 61d7e5c..f92bb40 100644 --- a/nodes/MakeFrame.py +++ b/nodes/MakeFrame.py @@ -6,7 +6,6 @@ import random from PIL import Image from .. import makeframeutils as mfu - device = torch.device("cuda" if torch.cuda.is_available() else "cpu") class BreakFrames: