diff --git a/setup.py b/setup.py index 5077a6b..9bb3de4 100644 --- a/setup.py +++ b/setup.py @@ -39,7 +39,7 @@ def read_long_description(): "imgaug", "numpy", "opencv-python", - "pillow>=8.2.0", + "pillow==10.3.0", "pygame", "python-bidi", "pytweening", diff --git a/synthtiger/layers/text_layer.py b/synthtiger/layers/text_layer.py index e45d0af..3f953f7 100644 --- a/synthtiger/layers/text_layer.py +++ b/synthtiger/layers/text_layer.py @@ -172,11 +172,11 @@ def _get_bbox(self, text, font, vertical): if not vertical: ascent, descent = font.getmetrics() - width = font.getsize(text, direction=direction)[0] + width = font.getmask(text, direction=direction).size[0] height = ascent + descent bbox = [0, -ascent, width, height] else: - width, height = font.getsize(text, direction=direction) + width,height = font.getmask(text, direction=direction).size bbox = [-width // 2, 0, width, height] return bbox