ComfyUI > Nodes > TrentNodes > Image Folder Cowboy

ComfyUI Node: Image Folder Cowboy

Class Name

ImageFolderCowboy

Category
Trent/Image
Author
TrentHunter82 (Account age: 0days)
Extension
TrentNodes
Latest Updated
2026-03-20
Github Stars
0.03K

How to Install TrentNodes

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

The ImageFolderCowboy node efficiently loads, sorts, and processes images for AI applications.

Image Folder Cowboy:

The ImageFolderCowboy node is designed to streamline the process of loading and managing images from a specified directory, making it an invaluable tool for AI artists who work with large collections of images. This node efficiently handles image loading by supporting various file formats such as PNG, JPG, JPEG, and WEBP, and offers natural sorting capabilities to ensure that numbered files are organized logically (e.g., img1, img2, img10). It also provides robust error handling to manage any issues that arise during the image loading process. By converting images to RGB format and extracting alpha channels for mask creation, the node prepares images for further processing in AI applications. The ImageFolderCowboy node is particularly beneficial for users who need to manage large batches of images, as it allows for configurable batch sizes and sorting options, ensuring that images are loaded in a manner that best suits the user's workflow.

Image Folder Cowboy Input Parameters:

directory

This parameter specifies the root directory from which images will be loaded. It is crucial for defining the location of your image files. The default value is an empty string, and it should be set to the path where your images are stored. This parameter does not have a minimum or maximum value but should be a valid directory path.

patterns

This parameter allows you to define the file patterns for matching images within the specified directory. It accepts a comma-separated list of glob patterns, with the default being **/*.png, **/*.jpg, **/*.jpeg, **/*.webp. This enables the node to identify and load images of various formats, ensuring flexibility in the types of images you can work with.

image_index

The image_index parameter determines the starting index for loading images, which can also serve as a batch index if increment_by_batch is enabled. It allows you to control which image to start loading from, with a default value of 0. The minimum value is 0, and the maximum is 999999, providing a wide range for indexing images.

sort_by

This parameter defines the method by which images are sorted before loading. Options include "name", "date_modified", "size", "random", and "none", with "name" being the default. This allows you to organize images based on your preferred criteria, such as natural sorting by name or by the date they were last modified.

sort_order

The sort_order parameter specifies the direction of sorting, with options for "ascending" or "descending". The default is "ascending", which means images will be loaded starting from the smallest or earliest value based on the sort_by criteria. This parameter helps in controlling the order in which images are processed.

batch_size

This parameter determines the number of images to load per execution, allowing you to manage the workload effectively. The default batch size is 1, with a minimum of 1 and a maximum of 64. Adjusting this parameter can optimize performance based on the available system resources and the size of the image dataset.

Image Folder Cowboy Output Parameters:

images

This output provides a batch of loaded images, converted to RGB format and prepared as tensors for further processing. It is essential for feeding images into AI models or other processing nodes.

masks

The masks output consists of alpha channel masks, which are inverted so that white areas represent transparency. This is useful for applications that require transparency information, such as compositing or masking operations.

filenames

This output contains the filenames of the loaded images, stripped of their extensions. It is useful for tracking and referencing images without dealing with full file paths.

total_count

The total_count output indicates the total number of images found in the specified directory. This provides an overview of the dataset size and helps in planning batch processing.

file_paths

This output provides the full file paths of the loaded images, allowing for easy access and reference to the original files on disk.

Image Folder Cowboy Usage Tips:

  • Ensure that the directory parameter is set to the correct path where your images are stored to avoid loading errors.
  • Use the patterns parameter to filter specific image formats you want to work with, which can help in managing large datasets with mixed file types.
  • Adjust the batch_size according to your system's capabilities to optimize performance and prevent memory overload.
  • Utilize the sort_by and sort_order parameters to organize images in a way that aligns with your project needs, such as processing images in chronological order or by size.

Image Folder Cowboy Common Errors and Solutions:

Error loading <file_path>

  • Explanation: This error occurs when the node encounters an issue while trying to load an image from the specified file path. It could be due to a corrupted file, unsupported format, or incorrect file path.
  • Solution: Verify that the file path is correct and that the image files are not corrupted. Ensure that the file formats are supported by the node (PNG, JPG, JPEG, WEBP).

IndexError: list index out of range

  • Explanation: This error may occur if the image_index is set beyond the available range of images in the directory.
  • Solution: Check the total_count output to ensure that the image_index is within the valid range of available images. Adjust the image_index parameter accordingly.

Image Folder Cowboy Related Nodes

Go back to the extension to check out more related nodes.
TrentNodes
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.

Image Folder Cowboy