bash-j / mikey_nodes

comfy nodes from mikey
MIT License
100 stars 15 forks source link

Caption seems to be broken on Python 3.11.6 + 2.1.0+cu121 #11

Closed JPS-GER closed 8 months ago

JPS-GER commented 11 months ago

I get the following error with Python 3.11.6 + Torch 2.1.0+cu121 (also used by the latest ComfyUI Standalone version):

!!! Exception during processing !!! Traceback (most recent call last): File "C:\Users\jpswi\ComfyUI_full\ComfyUI\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jpswi\ComfyUI_full\ComfyUI\execution.py", line 82, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jpswi\ComfyUI_full\ComfyUI\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(*slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jpswi\ComfyUI_full\ComfyUI\custom_nodes\mikey_nodes\mikey_nodes.py", line 2943, in caption wrapped_text_height = len(wrapped_lines) font.getsize('A')[1] # Estimate using height of letter 'A' ^^^^^^^^^^^^ AttributeError: 'FreeTypeFont' object has no attribute 'getsize'

bash-j commented 11 months ago

Hey, do you have a font file in the comfyui/fonts folder?

gnadenlos commented 11 months ago

I have the same problem and use a font in c:\windows\fonts. This worked before, until I updated Python and Torch:

image

JPS-GER commented 11 months ago

Hey, do you have a font file in the comfyui/fonts folder?

Not in the ComfyUI folder, just in c:\windows\fonts - which was no problem until ComfyUI was updated to a newer version of Python and Torch a few days ago.

bash-j commented 11 months ago

Looks like it was an issue caused by the new Pillow version 10.

Can you please update mikey nodes and try again?

JPS-GER commented 11 months ago

Still happens after the update:

image

bash-j commented 11 months ago

What about now?

JPS-GER commented 11 months ago

image

bash-j commented 11 months ago

Ok, hopefully this time it works. I also tweaked the positioning for multiple lines to stop the bottom row from being cut off.

If you get 'undefined' in the caption like I did, removing and re-adding the node fixed that issue.

JPS-GER commented 11 months ago

Thanks, it works again. But text gets still cut off in some cases:

image

With a different font (Arial standard, instead of Arial Black), it works better:

image