ForeignGods/ComfyUI-Mana-Nodes

'FreeTypeFont' object has no attribute 'getsize'

arlechinu opened this issue · 2 comments

Help please :)

Error occurred when executing font2img:

'FreeTypeFont' object has no attribute 'getsize'

File "D:\ComfyUI00\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI00\ComfyUI\execution.py", line 81, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI00\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI00\ComfyUI\custom_nodes\ComfyUI-Mana-Nodes\font2img_node.py", line 81, in run
formatted_transcription = self.format_transcription(transcription, image_width, font_file, start_font_size,padding)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI00\ComfyUI\custom_nodes\ComfyUI-Mana-Nodes\font2img_node.py", line 118, in format_transcription
width = self.get_text_width(new_sentence, font_file, font_size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ComfyUI00\ComfyUI\custom_nodes\ComfyUI-Mana-Nodes\font2img_node.py", line 139, in get_text_width
text_width, _ = font.getsize(text)
^^^^^^^^^^^^

Turns out the issue was not with the font2img node, but with the connection from the speech2text. Did not solve the issue with the workflow, but got the font2img node to work - muted all nodes except font2img and a preview node.

Just fixed this thanks for the feedback.
The issue was the use of a deprecated Pillow method name.
tensorflow/models#11040

I will release a huge update today with new features.
The fix will be included there.

Thanks for the feedback and I'll close the issue when I update the repo.