The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
fix: Image grid bug fix (CORE-215) (#14100)
Yousef R. Gamaleldin7758b9b321ae
diff --git a/comfy_extras/nodes_dataset.py b/comfy_extras/nodes_dataset.pyindex 104d16d91..0253b4b4f 100644--- a/comfy_extras/nodes_dataset.py+++ b/comfy_extras/nodes_dataset.py@@ -411,6 +411,21 @@ class ImageProcessingNode(io.ComfyNode):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+@classmethoddef define_schema(cls):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."""is_group = cls._detect_processing_mode()+ if is_group:+ images = cls._ensure_image_list(images)+# Extract scalar values from lists for parametersparams = {}for k, v in kwargs.items():