ComfyUI
ComfyUI copied to clipboard
Error When Loading 4000x4000 Image Size in LoadImage Node
When attempting to load an image of 4000x4000 dimensions, I receive an error message.
I remember using this node in November 2023 without any errors. How should I solve this problem?
- Loading: ComfyUI-Manager (V2.9)
- ComfyUI Revision: 2046 [a38b9b3a] | Released on '2024-03-04'
Here is the error message:
Error occurred when executing LoadImage:
Sizes of tensors must match except in dimension 0. Expected size 4000 but got size 1080 for tensor number 1 in the list.
File "/root/ComfyUI/execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "/root/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 "/root/ComfyUI/execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "/root/ComfyUI/nodes.py", line 1502, in load_image
output_image = torch.cat(output_images, dim=0)
Here is my workflow:
- This is the simplest workflow
{
"last_node_id": 12,
"last_link_id": 11,
"nodes": [
{
"id": 10,
"type": "LoadImage",
"pos": [
260,
340
],
"size": [
320,
310
],
"flags": {},
"order": 0,
"mode": 0,
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
10
],
"shape": 3,
"label": "图像"
},
{
"name": "MASK",
"type": "MASK",
"links": null,
"shape": 3,
"label": "遮罩"
}
],
"properties": {
"Node name for S&R": "LoadImage"
},
"widgets_values": [
"11_原 (1).JPG",
"image"
]
},
{
"id": 11,
"type": "ImageInvert",
"pos": [
680,
510
],
"size": {
"0": 210,
"1": 26
},
"flags": {},
"order": 1,
"mode": 0,
"inputs": [
{
"name": "image",
"type": "IMAGE",
"link": 10,
"label": "图像",
"slot_index": 0
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
11
],
"shape": 3,
"label": "图像"
}
],
"properties": {
"Node name for S&R": "ImageInvert"
}
},
{
"id": 12,
"type": "PreviewImage",
"pos": [
990,
530
],
"size": {
"0": 210,
"1": 26
},
"flags": {},
"order": 2,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 11,
"label": "图像",
"slot_index": 0
}
],
"properties": {
"Node name for S&R": "PreviewImage"
}
}
],
"links": [
[
10,
10,
0,
11,
0,
"IMAGE"
],
[
11,
11,
0,
12,
0,
"IMAGE"
]
],
"groups": [],
"config": {},
"extra": {},
"version": 0.4
}
Same issue. I conducted a separate test for this module, and it appears that the issue is not with comfyui but with the Pillow library. In my tests, when the size of a JPEG exceeds 4096*4096, Pillow incorrectly processes the image twice and scales it down. I will submit this issue along with my test code there.
Same issue. I conducted a separate test for this module, and it appears that the issue is not with comfyui but with the Pillow library. In my tests, when the size of a JPEG exceeds 4096*4096, Pillow incorrectly processes the image twice and scales it down. I will submit this issue along with my test code there.
https://github.com/python-pillow/Pillow/issues/7954
I downgraded to 10.2.0 and that fixed the issue for now