diff --git a/comfy_extras/nodes_images.py b/comfy_extras/nodes_images.py index 8bcb84c1a..e48b2ea2d 100644 --- a/comfy_extras/nodes_images.py +++ b/comfy_extras/nodes_images.py @@ -147,7 +147,7 @@ class ImageFromBatch(IO.ComfyNode): s_in = image if batch_index < 0: batch_index += s_in.shape[0] - batch_index = min(s_in.shape[0] - 1, batch_index) + batch_index = max(0, min(s_in.shape[0] - 1, batch_index)) length = min(s_in.shape[0] - batch_index, length) s = s_in[batch_index:batch_index + length].clone() return IO.NodeOutput(s) diff --git a/nodes.py b/nodes.py index 510048d9c..84dff0841 100644 --- a/nodes.py +++ b/nodes.py @@ -1234,7 +1234,7 @@ class LatentFromBatch: s_in = samples["samples"] if batch_index < 0: batch_index += s_in.shape[0] - batch_index = min(s_in.shape[0] - 1, batch_index) + batch_index = max(0, min(s_in.shape[0] - 1, batch_index)) length = min(s_in.shape[0] - batch_index, length) s["samples"] = s_in[batch_index:batch_index + length].clone() if "noise_mask" in samples: