mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-06-05 22:07:25 +08:00
fix: Image grid bug fix (CORE-215) (#14100)
This commit is contained in:
parent
bb84c75283
commit
7758b9b321
@ -411,6 +411,21 @@ class ImageProcessingNode(io.ComfyNode):
|
|||||||
|
|
||||||
return has_group
|
return has_group
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _ensure_image_list(cls, images):
|
||||||
|
"""Normalize to a flat list of [1, H, W, C] tensors."""
|
||||||
|
if isinstance(images, torch.Tensor):
|
||||||
|
if images.ndim != 4:
|
||||||
|
raise ValueError(f"Expected 4D image tensor, got shape {tuple(images.shape)}")
|
||||||
|
return [images[i:i+1] for i in range(images.shape[0])]
|
||||||
|
|
||||||
|
flat = []
|
||||||
|
for item in images:
|
||||||
|
if not isinstance(item, torch.Tensor) or item.ndim != 4:
|
||||||
|
raise ValueError(f"Expected 4D image tensor, got {type(item).__name__} shape {getattr(item, 'shape', None)}")
|
||||||
|
flat.extend([item[i:i+1] for i in range(item.shape[0])])
|
||||||
|
return flat
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def define_schema(cls):
|
def define_schema(cls):
|
||||||
if cls.node_id is None:
|
if cls.node_id is None:
|
||||||
@ -458,6 +473,9 @@ class ImageProcessingNode(io.ComfyNode):
|
|||||||
"""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()
|
||||||
|
|
||||||
|
if is_group:
|
||||||
|
images = cls._ensure_image_list(images)
|
||||||
|
|
||||||
# Extract scalar values from lists for parameters
|
# Extract scalar values from lists for parameters
|
||||||
params = {}
|
params = {}
|
||||||
for k, v in kwargs.items():
|
for k, v in kwargs.items():
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user