Video editing with Python
handle removed Pillow API
Zulkoa4649b40d74a
diff --git a/moviepy/video/VideoClip.py b/moviepy/video/VideoClip.pyindex 0b22a6d5..9fe4f92f 100644--- a/moviepy/video/VideoClip.py+++ b/moviepy/video/VideoClip.py@@ -1881,7 +1881,6 @@ class TextClip(ImageClip):draw = ImageDraw.Draw(img)# Compute individual line height with spaces using pillow internal method- line_height = draw._multiline_spacing(font_pil, spacing, stroke_width)if max_width is not None and allow_break:lines = self.__break_text(@@ -1908,11 +1907,17 @@ class TextClip(ImageClip):)# For height calculate manually as textbbox is not realiable- line_breaks = text.count("\n")- lines_height = line_breaks * line_height- paddings = real_font_size + stroke_width * 2-- return (int(right - left), int(lines_height + paddings))+ try:+ # this disappeared in more recent versions of Pillow+ line_height = draw._multiline_spacing(font_pil, spacing, stroke_width)+ line_breaks = text.count("\n")+ lines_height = line_breaks * line_height+ paddings = real_font_size + stroke_width * 2+ height = int(lines_height + paddings)+ except AttributeError as err:+ height = int(bottom - top)++ return (int(right - left), height)def __find_optimum_font_size(self,