From b026acb17bec4db23bf4292676aa0168f76ab6a0 Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Sat, 25 Nov 2023 22:48:33 +0200 Subject: [PATCH] Update nodes.py --- nodes.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nodes.py b/nodes.py index 7103c84..5d104e6 100644 --- a/nodes.py +++ b/nodes.py @@ -479,13 +479,15 @@ class GetImageRangeFromBatch: return { "required": { "images": ("IMAGE",), - "start_index": ("INT", {"default": 1,"min": 0, "max": 4096, "step": 1}), - "num_frames": ("INT", {"default": 1,"min": 0, "max": 4096, "step": 1}), + "start_index": ("INT", {"default": 0,"min": -1, "max": 4096, "step": 1}), + "num_frames": ("INT", {"default": 1,"min": 1, "max": 4096, "step": 1}), }, } def imagesfrombatch(self, images, start_index, num_frames): - if start_index >= len(images): + if start_index == -1: + start_index = len(images) - num_frames + if start_index < 0 or start_index >= len(images): raise ValueError("GetImageRangeFromBatch: Start index is out of range") end_index = start_index + num_frames if end_index > len(images):