Run ComfyUI Easily with InstaSD

Skip the complex setup. InstaSD helps creative professionals build workflows and deploy them to the world:

  • One-click deployment
  • Any model, any node
  • Powerful GPUs for rapid iteration
Get Started

Available Nodes

LoadImagesFromFolderKJ

LoadImagesFromFolderKJ Node Documentation

Overview

The LoadImagesFromFolderKJ node is part of the ComfyUI-KJNodes collection. This node is designed to load images from a specified folder and compile them into a batch. This is particularly useful for workflows that require processing multiple images at once. The node automatically resizes the images to fit a specified dimension, ensuring consistency in the batch size.

Functionality

What it Does

The LoadImagesFromFolderKJ node loads all valid image files (e.g., JPEG, PNG, WEBP) from a specified folder and processes them into a batched format. It resizes the images based on user-defined dimensions and methods (crop, pad, or stretch) to maintain aspect ratios or fill dimensions as needed. This node is ideal for scenarios where you need to batch process a series of images from a directory.

Inputs

  1. Folder Path (folder)

    • Type: String
    • Description: The path to the folder containing images that you want to load.
  2. Image Dimensions (width, height)

    • Type: Integer
    • Description: The target dimensions (width and height) to which all images should be resized.
  3. Aspect Ratio Handling (keep_aspect_ratio)

    • Options: Crop, Pad, Stretch
    • Description: Determines how images are resized to fit the specified dimensions. Use "crop" to cut the image, "pad" to add borders, and "stretch" to stretch the image.
  4. Image Load Cap (image_load_cap)

    • Type: Integer
    • Description: The maximum number of images to load. If set to 0, there is no limit.
  5. Start Index (start_index)

    • Type: Integer
    • Description: Index at which to start loading images from the folder.
  6. Include Subfolders (include_subfolders)

    • Type: Boolean
    • Description: If true, images from subfolders will also be loaded.

Outputs

  1. Image (image)

    • Type: Batched Image Tensor
    • Description: A batch of processed images from the specified folder.
  2. Mask (mask)

    • Type: Batched Mask Tensor
    • Description: Corresponding masks for the loaded images are generated or extracted if available.
  3. Image Count (count)

    • Type: Integer
    • Description: The total number of images successfully loaded into the batch.
  4. Image Path (image_path)

    • Type: String
    • Description: Paths to the images that were loaded.

Usage in ComfyUI Workflows

The LoadImagesFromFolderKJ node is a versatile tool in ComfyUI workflows, especially useful when dealing with large sets of images. It allows users to automate the batch processing of image folders, which is beneficial in tasks such as:

  • Preprocessing datasets for machine learning models.
  • Creating consistent image batches for batch image manipulations or augmentations.
  • Facilitating workflows that require uniform image sizes, such as generative art projects.

To integrate this node into a ComfyUI workflow, include it at the beginning of your operations to ensure all images are loaded and prepared in a batch, aligned to the same dimensions, and consistent in quality for subsequent processing.

Special Features or Considerations

  • Image Resizing: The node allows the user to maintain, adjust, or disregard aspect ratios based on the required outputs, giving flexibility in image preparation.
  • Batch Capabilities: Loading images in batch saves time and effort in workflows, optimizing processes that need multiple images to be processed at once.
  • Subfolder Inclusion: With the option to include subfolders, users can process more complex directory structures without needing manual intervention.
  • Start Index Feature: Permits users to load images from a specific point within a folder, useful in situations where you need to retry or continue processing from a desired index without reloading previously processed images.

Note: Ensure that the folder path is correctly specified and accessible by the system ComfyUI is running on. Adjust image load limits and indices as needed to fit within RAM constraints or project requirements.