From b3ce5bd726b33bb8218618175fbed48d65ea750f Mon Sep 17 00:00:00 2001 From: bash-j Date: Wed, 11 Oct 2023 19:25:04 +1030 Subject: [PATCH] fix issue with image caption and Pillow 10 --- mikey_nodes.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mikey_nodes.py b/mikey_nodes.py index bcbf5e7..9fd0755 100644 --- a/mikey_nodes.py +++ b/mikey_nodes.py @@ -2940,7 +2940,11 @@ class ImageCaption: wrapped_lines = self.wrap_text(caption, font, max_width) # Calculate height needed for wrapped text - wrapped_text_height = len(wrapped_lines) * font.getsize('A')[1] # Estimate using height of letter 'A' + try: + wrapped_text_height = len(wrapped_lines) * font.getsize('A')[1] # Estimate using height of letter 'A' + except AttributeError: + # use new getlength method instead of deprecated getsize + wrapped_text_height = len(wrapped_lines) * font.getlength('A') # Estimate using height of letter 'A' caption_height = wrapped_text_height + 25 # A little buffer for better visual appeal # Create the caption bar