ComfyUI Node: Smart Image Range Extractor

Class Name

SmartImageRangeExtractor

Category
VLM/Video
Author
fblissjr (Account age: 4014days)
Extension
Shrug-Prompter: Unified VLM Integration for ComfyUI
Latest Updated
2025-09-30
Github Stars
0.02K

How to Install Shrug-Prompter: Unified VLM Integration for ComfyUI

Install this extension via the ComfyUI Manager by searching for Shrug-Prompter: Unified VLM Integration for ComfyUI
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Shrug-Prompter: Unified VLM Integration for ComfyUI in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Smart Image Range Extractor Description

Efficiently extracts specific image ranges from batches using zero-copy views for optimized memory.

Smart Image Range Extractor:

The SmartImageRangeExtractor is a sophisticated node designed to efficiently extract specific ranges of images from a batch without duplicating data, thereby optimizing memory usage. This node is particularly beneficial in video processing workflows where you need to handle large volumes of image data. By leveraging zero-copy views, it ensures that the extraction process is both fast and resource-efficient. Additionally, it includes automatic cleanup mechanisms to maintain optimal performance. The SmartImageRangeExtractor is an enhanced version of the ImageRangeExtractor, offering improved functionality and flexibility. It allows you to specify the starting point, the number of images to extract, and the step size between images, with an option to reverse the extraction order. This makes it a versatile tool for tasks that require precise control over image selection, such as creating video clips or analyzing specific frames in a sequence.

Smart Image Range Extractor Input Parameters:

images

This parameter represents the batch of images from which you want to extract a range. It is expected to be a 4D tensor with dimensions corresponding to batch size, height, width, and channels (B, H, W, C). The images parameter is crucial as it serves as the source data for the extraction process.

start

The start parameter specifies the index of the first image in the batch from which the extraction should begin. It is an integer with a default value of 0, and it must be at least 0. This parameter allows you to control the starting point of the extraction, enabling you to skip over initial images if desired.

count

This parameter determines the number of images to extract from the starting index. It is an integer with a default value of 1 and a minimum value of 1. The count parameter is essential for defining the size of the image range you wish to extract, allowing you to tailor the output to your specific needs.

step

The step parameter defines the interval between consecutive images in the extracted range. It is an optional integer parameter with a default value of 1, a minimum value of 1, and a maximum value of 10. By adjusting the step size, you can control the density of the extracted images, which is useful for creating time-lapse effects or reducing data volume.

reverse

This optional boolean parameter, with a default value of False, determines the direction of the extraction. If set to True, the extraction will proceed in reverse order, starting from the end of the batch. This feature is particularly useful when you need to analyze or process images from the end of a sequence backward.

Smart Image Range Extractor Output Parameters:

image_range

The image_range output is a subset of the original batch of images, extracted according to the specified parameters. It is a 4D tensor containing the selected images, and its size depends on the count and step parameters. This output is crucial for further processing or analysis, as it provides the specific frames you are interested in.

actual_count

This output parameter is an integer representing the actual number of images extracted. It provides feedback on the extraction process, confirming how many images were successfully retrieved based on the input parameters. This information is useful for verifying the results and ensuring that the extraction met your expectations.

info

The info output is a string that provides a summary of the extraction process, including details such as the number of frames extracted and the indices of the first and last images in the range. This output serves as a helpful log for understanding the extraction operation and can be used for debugging or documentation purposes.

Smart Image Range Extractor Usage Tips:

  • To optimize performance, ensure that the images parameter is a 4D tensor with the correct dimensions, as this is crucial for the node's operation.
  • Use the step parameter to control the density of the extracted images, which can be particularly useful for creating effects like time-lapses or reducing data volume for analysis.

Smart Image Range Extractor Common Errors and Solutions:

Expected 4D tensor (B,H,W,C), got <images.dim()>D

  • Explanation: This error occurs when the input images parameter does not have the expected 4D shape.
  • Solution: Ensure that the images input is a 4D tensor with dimensions corresponding to batch size, height, width, and channels.

No valid indices

  • Explanation: This error indicates that the calculated indices for extraction are not valid, possibly due to incorrect start, count, or step values.
  • Solution: Verify that the start, count, and step parameters are set correctly and that they result in valid indices within the bounds of the image batch. Adjust these parameters as needed to ensure a valid extraction range.

Smart Image Range Extractor Related Nodes

Go back to the extension to check out more related nodes.
Shrug-Prompter: Unified VLM Integration for ComfyUI
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

Smart Image Range Extractor