Closed PKS-formido closed 8 months ago
You should check if Pillow is installed and up to date in your python_embeded directory. Are you using the standalone ComfyUI build? Please share your workflow with me so i can try to recreate your error message. Thanks for the feedback.
Okay, I will check the status of the Pillow. Should the models be exactly the same as it is in the emaple_workflow? I'm asking because I have changed the models.
Just google searched this error. It might also be the case that draw.textsize is not supported by newer Pillow versions :( Please let me know what version you are using.
My setup
Collecting Pillow
Using cached pillow-10.2.0-cp312-cp312-win_amd64.whl.metadata (9.9 kB)
Using cached pillow-10.2.0-cp312-cp312-win_amd64.whl (2.6 MB)
Installing collected packages: Pillow
Successfully installed Pillow-10.2.0
Name: pillow
Version: 10.2.0
Summary: Python Imaging Library (Fork)
Home-page:
Author:
Author-email: "Jeffrey A. Clark (Alex)" <aclark@aclark.net>
License: HPND
Location:
Requires:
Required-by: imageio, imgviz, matplotlib, torchvision
Okay, I will check the status of the Pillow. Should the models be exactly the same as it is in the emaple_workflow? I'm asking because I have changed the models.
The example_workflow is for sd 1.5 models, if you want to use sdxl you would have to change the animateDiff model in the loader. But the font2img node should work independent of the models you use. Try testing the font2img with a simple previewImage node to check what is causing the issue.
Name: pillow Version: 10.2.0 Summary: Python Imaging Library (Fork) Home-page: Author: Author-email: "Jeffrey A. Clark (Alex)" aclark@aclark.net License: HPND Location: /root/miniconda3/envs/py3.10/lib/python3.10/site-packages Requires: Required-by: torchvision
I'm using the same pillow version. But I think I don't have imageio, imgviz, matplotlib. Are they also required?
Okay I will try with sd 1.5 models and let you know. Amazed by your quick replies :D
I'm using the same pillow version. But I think I don't have imageio, imgviz, matplotlib. Are they also required?
No they are not required, it definitely has something to do with Pillow.
I used the exact same models as you did. Still getting that error :(
Same error here too, I upgraded my pillow, but still can't run it ''''
'ImageDraw' object has no attribute 'textsize'
File "E:\COMFYUI\ComfyUI_windows_portable12_1\ComfyUI\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\COMFYUI\ComfyUI_windows_portable12_1\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 "E:\COMFYUI\ComfyUI_windows_portable12_1\ComfyUI\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\COMFYUI\ComfyUI_windows_portable12_1\ComfyUI\custom_nodes\ComfyUI-Mana-Nodes\font2img_node.py", line 77, in run images= self.generate_images(start_font_size, font_size_increment, frame_text_dict, rotation_increment, x_offset_increment, y_offset_increment, start_x_offset, end_x_offset, start_y_offset, end_y_offset, font_file, font_color, background_color, image_width, image_height, text_alignment, line_spacing, frame_count, input_images, anchor_x, anchor_y, rotate_around_center, kerning) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\COMFYUI\ComfyUI_windows_portable12_1\ComfyUI\custom_nodes\ComfyUI-Mana-Nodes\font2img_node.py", line 309, in generate_images text_width, text_height = self.calculate_text_block_size(draw, text, font, line_spacing, kerning) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\COMFYUI\ComfyUI_windows_portable12_1\ComfyUI\custom_nodes\ComfyUI-Mana-Nodes\font2img_node.py", line 136, in calculate_text_block_size char_width, char_height = draw.textsize(char, font=font) ^^^^^^^^^^^^^ ''''
@PKS-formido sorry for hi-jacking your thread, I didn't want to have a duplicate
Found this on stackoverflow, currently changing the logic from textsize to textlength. Hope this fixes the error. I'll let you know when i commit the fix.
Just updated font2img_node.py, please let me know if this fixed your issue.
Yes It's fixed :)
Error occurred when executing KSampler:
'NoneType' object has no attribute 'shape'
File "/home/ComfyUI/execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "/home/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 "/home/ComfyUI/execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(slice_dict(input_data_all, i))) File "/home/ComfyUI/nodes.py", line 1375, in sample return common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise=denoise) File "/home/ComfyUI/nodes.py", line 1345, in common_ksampler samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, File "/home/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/sampling.py", line 346, in motion_sample latents = wrap_function_to_inject_xformers_bug_info(orig_comfy_sample)(model, noise, *args, *kwargs) File "/home/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/utils_model.py", line 360, in wrapped_function return function_to_wrap(args, kwargs) File "/home/ComfyUI/comfy/sample.py", line 100, in sample samples = sampler.sample(noise, positive_copy, negative_copy, cfg=cfg, latent_image=latent_image, start_step=start_step, last_step=last_step, force_full_denoise=force_full_denoise, denoise_mask=noise_mask, sigmas=sigmas, callback=callback, disable_pbar=disable_pbar, seed=seed) File "/home/ComfyUI/comfy/samplers.py", line 713, in sample return sample(self.model, noise, positive, negative, cfg, self.device, sampler, sigmas, self.model_options, latent_image=latent_image, denoise_mask=denoise_mask, callback=callback, disable_pbar=disable_pbar, seed=seed) File "/home/ComfyUI/comfy/samplers.py", line 618, in sample samples = sampler.sample(model_wrap, sigmas, extra_args, callback, noise, latent_image, denoise_mask, disable_pbar) File "/home/ComfyUI/comfy/samplers.py", line 557, in sample samples = self.sampler_function(model_k, noise, sigmas, extra_args=extra_args, callback=k_callback, disable=disable_pbar, self.extra_options) File "/root/miniconda3/envs/py3.10/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(*args, *kwargs) File "/home/ComfyUI/comfy/k_diffusion/sampling.py", line 580, in sample_dpmpp_2m denoised = model(x, sigmas[i] s_in, extra_args) File "/root/miniconda3/envs/py3.10/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl return self._call_impl(*args, kwargs) File "/root/miniconda3/envs/py3.10/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl return forward_call(*args, *kwargs) File "/home/ComfyUI/comfy/samplers.py", line 281, in forward out = self.inner_model(x, sigma, cond=cond, uncond=uncond, cond_scale=cond_scale, model_options=model_options, seed=seed) File "/root/miniconda3/envs/py3.10/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) File "/root/miniconda3/envs/py3.10/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl return forward_call(*args, kwargs) File "/home/ComfyUI/comfy/samplers.py", line 271, in forward return self.apply_model(*args, *kwargs) File "/home/ComfyUI/comfy/samplers.py", line 268, in apply_model out = sampling_function(self.inner_model, x, timestep, uncond, cond, cond_scale, model_options=model_options, seed=seed) File "/home/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/sampling.py", line 385, in evolved_sampling_function cond_pred, uncond_pred = sliding_calc_cond_uncondbatch(model, cond, uncond, x, timestep, model_options) File "/home/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/sampling.py", line 494, in sliding_calc_cond_uncond_batch sub_cond_out, sub_uncond_out = comfy.samplers.calc_cond_uncond_batch(model, sub_cond, sub_uncond, sub_x, sub_timestep, model_options) File "/home/ComfyUI/comfy/samplers.py", line 197, in calc_cond_uncond_batch c['control'] = control.get_control(inputx, timestep, c, len(cond_or_uncond)) File "/home/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/utils.py", line 468, in get_control_inject return self.get_control_advanced(x_noisy, t, cond, batched_number) File "/home/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/control.py", line 32, in get_control_advanced return self.sliding_get_control(x_noisy, t, cond, batched_number) File "/home/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/control.py", line 78, in sliding_get_control control = self.control_model(x=x_noisy.to(dtype), hint=self.cond_hint, timesteps=timestep.float(), context=context.to(dtype), y=y) File "/root/miniconda3/envs/py3.10/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) File "/root/miniconda3/envs/py3.10/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl return forward_call(*args, **kwargs) File "/home/ComfyUI/comfy/cldm/cldm.py", line 295, in forward assert y.shape[0] == x.shape[0]
Sorry to bother.. I'm getting this issue now
I think your new error message is unrelated to this issue. Please open a new one. There you can send me the workflow that's causing the problem. I'll close this issue now.
Error occurred when executing font2img:
'ImageDraw' object has no attribute 'textsize'
File "/home/ComfyUI/execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "/home/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 "/home/ComfyUI/execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) File "/home/ComfyUI/custom_nodes/ComfyUI-Mana-Nodes/font2img_node.py", line 77, in run images= self.generate_images(start_font_size, font_size_increment, frame_text_dict, rotation_increment, x_offset_increment, y_offset_increment, start_x_offset, end_x_offset, start_y_offset, end_y_offset, font_file, font_color, background_color, image_width, image_height, text_alignment, line_spacing, frame_count, input_images, anchor_x, anchor_y, rotate_around_center, kerning) File "/home/ComfyUI/custom_nodes/ComfyUI-Mana-Nodes/font2img_node.py", line 309, in generate_images text_width, text_height = self.calculate_text_block_size(draw, text, font, line_spacing, kerning) File "/home/ComfyUI/custom_nodes/ComfyUI-Mana-Nodes/font2img_node.py", line 136, in calculate_text_block_size char_width, char_height = draw.textsize(char, font=font)
How do I fix this error?