mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-27 17:37:39 +08:00
image grid bug fix
This commit is contained in:
parent
0077d78cbf
commit
1d0b024bf2
@ -393,6 +393,27 @@ class ImageProcessingNode(io.ComfyNode):
|
|||||||
|
|
||||||
return has_group
|
return has_group
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _ensure_image_list(cls, images):
|
||||||
|
"""Normalize to a flat list of individual (H,W,C) tensors."""
|
||||||
|
|
||||||
|
# raw tensor
|
||||||
|
if isinstance(images, torch.Tensor):
|
||||||
|
if images.ndim == 4:
|
||||||
|
return [images[i] for i in range(images.shape[0])]
|
||||||
|
if images.ndim == 3:
|
||||||
|
return [images]
|
||||||
|
raise ValueError(f"Unexpected image tensor ndim: {images.ndim}, shape: {images.shape}")
|
||||||
|
|
||||||
|
# flatten batched images inside a list/tuple
|
||||||
|
flat = []
|
||||||
|
for item in images:
|
||||||
|
if isinstance(item, torch.Tensor) and item.ndim == 4:
|
||||||
|
flat.extend([item[i] for i in range(item.shape[0])])
|
||||||
|
else:
|
||||||
|
flat.append(item)
|
||||||
|
return flat
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def define_schema(cls):
|
def define_schema(cls):
|
||||||
if cls.node_id is None:
|
if cls.node_id is None:
|
||||||
@ -439,6 +460,7 @@ class ImageProcessingNode(io.ComfyNode):
|
|||||||
def execute(cls, images, **kwargs):
|
def execute(cls, images, **kwargs):
|
||||||
"""Execute the node. Routes to _process or _group_process based on mode."""
|
"""Execute the node. Routes to _process or _group_process based on mode."""
|
||||||
is_group = cls._detect_processing_mode()
|
is_group = cls._detect_processing_mode()
|
||||||
|
images = cls._ensure_image_list(images)
|
||||||
|
|
||||||
# Extract scalar values from lists for parameters
|
# Extract scalar values from lists for parameters
|
||||||
params = {}
|
params = {}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user