ComfyUI > Nodes > cspnodes > Image Dir Iterator

ComfyUI Node: Image Dir Iterator

Class Name

ImageDirIterator

Category
cspnodes
Author
cerspense (Account age: 3005days)
Extension
cspnodes
Latest Updated
2024-12-17
Github Stars
0.03K

How to Install cspnodes

Install this extension via the ComfyUI Manager by searching for cspnodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter cspnodes 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

Image Dir Iterator Description

Facilitates sequential processing of images in a directory for batch operations and automation.

Image Dir Iterator:

The ImageDirIterator is a node designed to facilitate the sequential processing of images stored within a directory. Its primary purpose is to iterate over a collection of images, allowing you to perform operations on each image in a systematic manner. This node is particularly beneficial for tasks that require batch processing of images, such as applying transformations, extracting features, or preparing datasets for machine learning models. By automating the iteration process, ImageDirIterator streamlines workflows that involve large volumes of image data, ensuring consistency and efficiency. It is an essential tool for AI artists and developers who need to manage and manipulate image datasets without manually handling each file.

Image Dir Iterator Input Parameters:

directory_path

The directory_path parameter specifies the location of the directory containing the images you wish to process. It is crucial for the node to know where to look for the images, and this parameter should be a valid path to a directory on your system. The accuracy of this path directly impacts the node's ability to locate and iterate over the images.

glob_patterns

The glob_patterns parameter allows you to define specific patterns for matching filenames within the directory. This is useful for filtering images based on their file extensions or naming conventions. By setting appropriate patterns, you can control which images are included in the iteration process, thus optimizing the node's performance for your specific needs.

image_index

The image_index parameter determines the starting point for the iteration within the directory. It allows you to specify which image to begin processing from, providing flexibility in cases where you do not want to start from the first image. This can be particularly useful when resuming a previously interrupted process.

sort_by

The sort_by parameter defines the criteria for sorting the images before iteration. You can choose to sort images by attributes such as name, date modified, or size. Sorting can help ensure that images are processed in a specific order, which might be necessary for certain applications.

sort_order

The sort_order parameter specifies whether the sorting should be in ascending or descending order. This parameter works in conjunction with sort_by to provide precise control over the sequence in which images are processed.

batch_size

The batch_size parameter sets the number of images to be processed in each batch. This is important for managing memory usage and processing time, especially when dealing with large datasets. A larger batch size may speed up processing but requires more memory, while a smaller batch size is more memory-efficient but may take longer.

increment_by_batch

The increment_by_batch parameter determines whether the iteration should move to the next batch after processing the current one. This is useful for batch processing scenarios where you want to process images in groups rather than individually.

randomize_final_list

The randomize_final_list parameter allows you to shuffle the order of images before processing. This can be beneficial for tasks that require random sampling or when you want to introduce variability in the processing sequence to prevent overfitting in machine learning applications.

Image Dir Iterator Output Parameters:

output_images

The output_images parameter provides the processed images as a result of the iteration. Each image is transformed into a format suitable for further processing or analysis, ensuring that you have a consistent output to work with in subsequent steps of your workflow.

output_masks

The output_masks parameter delivers the corresponding masks for each processed image. Masks are often used in image segmentation tasks to highlight specific areas of interest within an image. This output is crucial for applications that require precise image analysis or manipulation.

Image Dir Iterator Usage Tips:

  • Ensure that the directory_path is correctly set to avoid errors in locating images.
  • Use glob_patterns to filter images effectively, especially when dealing with mixed file types.
  • Adjust batch_size according to your system's memory capacity to optimize performance.
  • Consider using randomize_final_list for tasks that benefit from non-sequential image processing.

Image Dir Iterator Common Errors and Solutions:

Invalid directory path

  • Explanation: The specified directory_path does not exist or is incorrect.
  • Solution: Verify the path and ensure it points to a valid directory containing images.

No images found matching the pattern

  • Explanation: The glob_patterns do not match any files in the directory.
  • Solution: Check the patterns for typos or adjust them to match the desired file types.

Insufficient memory for batch size

  • Explanation: The batch_size is too large for the available system memory.
  • Solution: Reduce the batch_size to a level that your system can handle comfortably.

Sorting criteria not applicable

  • Explanation: The sort_by parameter is set to an attribute that does not exist for the files.
  • Solution: Choose a valid attribute for sorting, such as name or date modified.

Image Dir Iterator Related Nodes

Go back to the extension to check out more related nodes.
cspnodes
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 Playground, enabling artists to harness the latest AI tools to create incredible art.