mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-12-16 17:42:58 +08:00
Fix ImageBatch with different channel count. (#10815)
This commit is contained in:
parent
87b0359392
commit
f5e66d5e47
4
nodes.py
4
nodes.py
@ -1852,6 +1852,10 @@ class ImageBatch:
|
|||||||
CATEGORY = "image"
|
CATEGORY = "image"
|
||||||
|
|
||||||
def batch(self, image1, image2):
|
def batch(self, image1, image2):
|
||||||
|
if image1.shape[-1] != image2.shape[-1]:
|
||||||
|
channels = min(image1.shape[-1], image2.shape[-1])
|
||||||
|
image1 = image1[..., :channels]
|
||||||
|
image2 = image2[..., :channels]
|
||||||
if image1.shape[1:] != image2.shape[1:]:
|
if image1.shape[1:] != image2.shape[1:]:
|
||||||
image2 = comfy.utils.common_upscale(image2.movedim(-1,1), image1.shape[2], image1.shape[1], "bilinear", "center").movedim(1,-1)
|
image2 = comfy.utils.common_upscale(image2.movedim(-1,1), image1.shape[2], image1.shape[1], "bilinear", "center").movedim(1,-1)
|
||||||
s = torch.cat((image1, image2), dim=0)
|
s = torch.cat((image1, image2), dim=0)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user