KJNodes/imagegenerated

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

image
mask
count
image_path
folder
STRING
width
1024
height
1024
keep_aspect_ratio
COMBO
image_load_cap
0
start_index
0
include_subfolders
KJNodes

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 NameData TypeRequiredDefault ValueRange/OptionsDescription
keep_aspect_ratioCOMBOYescrop"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).
folderSTRINGYes--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.
widthINTYes1024-1 and abovewidth (input parameter): Sets the target width for the output image in pixels. Use -1 to keep original width.
heightINTYes1024-1 and aboveheight (input parameter): Sets the target height for the output image in pixels. Use -1 to keep original height.
image_load_capINTNo00 and aboveLimits the number of images loaded from the folder. A value of 0 means no limit.
start_indexINTNo00 and aboveSkips images before this index when loading from the sorted file list.
include_subfoldersBOOLEANNoFalseTrue/FalseIf enabled, also loads images from subfolders recursively.

Output

Parameter NameData TypeDescription
imageIMAGEimage (output parameter): Outputs the processed image tensor for use by subsequent nodes.
maskMASKmask (output parameter): Outputs the mask corresponding to the image, typically used to identify non-transparent areas.
countINTcount (output parameter): Outputs the total number of image files successfully loaded in this operation.
image_pathSTRINGimage_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.

The Load Images From Folder (KJ) node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…