From 5b8d419c6f9c2ab6559a5758f7f504cb8b3a8412 Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Tue, 14 Jan 2025 21:21:35 +0200 Subject: [PATCH] Update image_nodes.py --- nodes/image_nodes.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nodes/image_nodes.py b/nodes/image_nodes.py index 1e45b7e..f2ea3ec 100644 --- a/nodes/image_nodes.py +++ b/nodes/image_nodes.py @@ -1585,14 +1585,13 @@ Randomizes image order within a batch. } def imagesfrombatch(self, start_index, num_frames, images=None, masks=None): - chosen_images = None chosen_masks = None # Process images if provided if images is not None: if start_index == -1: - start_index = len(images) - num_frames + start_index = max(0, len(images) - num_frames) if start_index < 0 or start_index >= len(images): raise ValueError("Start index is out of range") end_index = start_index + num_frames @@ -1603,7 +1602,7 @@ Randomizes image order within a batch. # Process masks if provided if masks is not None: if start_index == -1: - start_index = len(masks) - num_frames + start_index = max(0, len(masks) - num_frames) if start_index < 0 or start_index >= len(masks): raise ValueError("Start index is out of range for masks") end_index = start_index + num_frames