Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeFontType error #343

Open
sull1vn opened this issue Jun 12, 2024 · 1 comment
Open

FreeFontType error #343

sull1vn opened this issue Jun 12, 2024 · 1 comment

Comments

@sull1vn
Copy link

sull1vn commented Jun 12, 2024

When I try to generate images from the CLI using trdg -c 1000 -w 5 -f 64 or a custom Python script I get AttributeError: 'FreeTypeFont' object has no attribute 'getsize'. Specifically on File "C:\Program Files\Python312\Lib\multiprocessing\pool.py", line 125, in worker result = (True, func(*args, **kwds)) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\\AppData\Roaming\Python\Python312\site-packages\trdg\data_generator.py", line 22, in generate_from_tuple cls.generate(*t) File "C:\Users\\AppData\Roaming\Python\Python312\site-packages\trdg\data_generator.py", line 72, in generate image, mask = computer_text_generator.generate( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\y\AppData\Roaming\Python\Python312\site-packages\trdg\computer_text_generator.py", line 36, in generate return _generate_horizontal_text( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\\AppData\Roaming\Python\Python312\site-packages\trdg\computer_text_generator.py", line 107, in _generate_horizontal_text text_height = max([get_text_height(image_font, p) for p in splitted_text]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\\AppData\Roaming\Python\Python312\site-packages\trdg\utils.py", line 122, in get_text_height return image_font.getsize(text)[1]

@patrikdh
Copy link

reinstalling the Pillow package to 9.5 version fixed this error for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants