filipemeneses / comfy_pixelization

ComfyUI Node to pixelize images
36 stars 8 forks source link

Support for batch size > 1 #2

Closed Blucknote closed 1 year ago

Blucknote commented 1 year ago

Expected behavior:

On batch size > 1 pictures grouping like this

image

Actual behavior:

Error occurred when executing Pixelization:

Cannot handle this data type: (1, 1, 1024, 3), |u1

File "/media/evgen/AI/Art/ComfyUI/execution.py", line 145, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "/media/evgen/AI/Art/ComfyUI/execution.py", line 75, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "/media/evgen/AI/Art/ComfyUI/execution.py", line 68, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "/media/evgen/AI/Art/ComfyUI/custom_nodes/comfy_pixelization/__init__.py", line 202, in pixelize
image = tensor2pil(image)
File "/media/evgen/AI/Art/ComfyUI/custom_nodes/comfy_pixelization/__init__.py", line 164, in tensor2pil
return Image.fromarray(np.clip(255. * image.cpu().numpy().squeeze(), 0, 255).astype(np.uint8))
File "/home/evgen/ai/lib/python3.10/site-packages/PIL/Image.py", line 2994, in fromarray
raise TypeError("Cannot handle this data type: %s, %s" % typekey) from e

On batch size == 1 all working correctly

filipemeneses commented 1 year ago

Added support with c05e3ad

Example workflow: 1690834972_ComfyUI_00004_

image