Load Images From Folder (KJ)(LoadImagesFromFolderKJ)
This node supports reading image files in JPG, JPEG, PNG, WEBP, and TGA formats.
Load Images From Folder KJ
The Load Images From Folder (KJ) node supports reading image files in JPG, JPEG, PNG, WEBP, and TGA formats.
The Load Images From Folder (KJ) node is an image loader specifically designed for batch reading of image files from a specified folder. Its core function is to automatically scan the folder, uniformly process the found images, and output them for subsequent batch processing or analysis in the workflow.
Node Functionality
This node supports reading image files in JPG, JPEG, PNG, WEBP, and TGA formats. It determines whether content has been updated by monitoring changes in file modification times and quantities within the folder, thereby deciding if reprocessing is necessary. The node offers multiple image resizing strategies to accommodate different processing requirements.
Node Parameter Description - Load Images From Folder (KJ)
Control Parameters (Parameters)
| Parameter Name | Data Type | Required | Default Value | Range/Options | Description |
|---|---|---|---|---|---|
keep_aspect_ratio | COMBO | Yes | crop | "crop", "pad", "stretch" | Determines how images are resized to the target dimensions: "crop" (crop to fit), "pad" (pad with transparency), or "stretch" (distort to fit). |
folder | STRING | Yes | - | - | folder (input parameter): Specifies the folder path from which to load image files. Can be an absolute path or a relative path to the ComfyUI base directory. |
width | INT | Yes | 1024 | -1 and above | width (input parameter): Sets the target width for the output image in pixels. Use -1 to keep original width. |
height | INT | Yes | 1024 | -1 and above | height (input parameter): Sets the target height for the output image in pixels. Use -1 to keep original height. |
image_load_cap | INT | No | 0 | 0 and above | Limits the number of images loaded from the folder. A value of 0 means no limit. |
start_index | INT | No | 0 | 0 and above | Skips images before this index when loading from the sorted file list. |
include_subfolders | BOOLEAN | No | False | True/False | If enabled, also loads images from subfolders recursively. |
Output
| Parameter Name | Data Type | Description |
|---|---|---|
| image | IMAGE | image (output parameter): Outputs the processed image tensor for use by subsequent nodes. |
| mask | MASK | mask (output parameter): Outputs the mask corresponding to the image, typically used to identify non-transparent areas. |
| count | INT | count (output parameter): Outputs the total number of image files successfully loaded in this operation. |
| image_path | STRING | image_path (output parameter): Outputs the complete file path string of the currently loaded image. |
Use Cases
This node is very useful when building workflows for batch image processing or dataset preparation. For example, you can connect it to an Upscale or Style Transfer node to perform uniformly-specified enhancement processing on all images in a folder, or use it to create training sets.
Notes
Please note that if the specified folder path does not exist or is empty, the node may not function properly. Additionally, when processing a large number of high-resolution images, be mindful of system memory usage.
Load Images From Folder (KJ) Node Source Code Link
The Load Images From Folder (KJ) node is from the ComfyUI-KJNodes node package.
Comments
Sign in with GitHub to join the discussion.