Skip to content

Commit f5e66d5

Browse files
Fix ImageBatch with different channel count. (Comfy-Org#10815)
1 parent 87b0359 commit f5e66d5

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

nodes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,6 +1852,10 @@ def INPUT_TYPES(s):
18521852
CATEGORY = "image"
18531853

18541854
def batch(self, image1, image2):
1855+
if image1.shape[-1] != image2.shape[-1]:
1856+
channels = min(image1.shape[-1], image2.shape[-1])
1857+
image1 = image1[..., :channels]
1858+
image2 = image2[..., :channels]
18551859
if image1.shape[1:] != image2.shape[1:]:
18561860
image2 = comfy.utils.common_upscale(image2.movedim(-1,1), image1.shape[2], image1.shape[1], "bilinear", "center").movedim(1,-1)
18571861
s = torch.cat((image1, image2), dim=0)

0 commit comments

Comments
 (0)