Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > ComfyUI-XENodes > Load Image From Folder

ComfyUI Node: Load Image From Folder

Class Name

XENodes.LoadImageFromFolder

Category
xenodes/image
Author
xeinherjer-dev (Account age: 1528days)
Extension
ComfyUI-XENodes
Latest Updated
2026-11-01
Github Stars
0.01K

How to Install ComfyUI-XENodes

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

Load Image From Folder Description

Loads a selected image from a folder or file path, with its transparency mask and file details.

Load Image From Folder:

Load Image From Folder brings one image at a time into your workflow from a folder or a direct image file path. It is useful when you want to work through a collection of images in queued runs or send individual images to a vision model. The node selects a file from the images it finds, opens it at its original dimensions without resizing, corrects its orientation using embedded camera information when available, and prepares both the image and any transparency information for downstream nodes. It also attempts to show a preview in the interface; the preview is separate from the image passed through the workflow.

Load Image From Folder Input Parameters:

path

The folder to search, or a direct path to an image file. This is a folder dropdown with a default of output; its choices are folders discovered under ComfyUI’s output and input directories. You can also supply a path directly. Paths beginning with output/ or input/ refer to those ComfyUI directories, and an empty path resolves to the output directory. For a relative path without either prefix, the node checks output first, then input. The resolved path must be inside an allowed directory and must exist. A direct path to a supported image file gives the node a one-image list, while a folder lets it choose among the images found there.

folder_sort

Controls how folders are displayed in the path dropdown, not how images within a folder are selected. The options are newest_first and oldest_first; the default is newest_first. Choose the display order that makes your intended folder easier to find. Image ordering is controlled separately by sort_by.

index

Selects which image to load from the ordered list, starting at 0 for the first image. This integer has a minimum of 0, a maximum of 18446744073709551615, a step of 1, and a default of 0. If the value is larger than the number of images, it wraps around: for example, with three images, an index of 4 selects the second image. Its after-generate control supports changing the index across queued runs, including auto-incrementing or randomizing it. When sort_by is random, the index also seeds the file shuffle, so changing it can change both the order and the selected image.

sort_by

Sets the order of images before index selects one. The options are name, date_modified, date_created, and random; the default is name. Name sorting orders files by path, while the date options order them by filesystem modification or creation-time values. random shuffles the found images using index as its seed and causes the node to refresh on execution rather than reuse its usual result fingerprint. Use a date option when you want an order based on file timestamps, or name when filenames define the sequence you intend to process.

reverse

Reverses the selected non-random file order when set to True. This optional Boolean defaults to False and has the choices False and True. For example, pairing it with date_modified changes which end of the timestamp-ordered list appears first. It has no effect when sort_by is random.

subfolders

Includes supported images in folders beneath the selected folder when set to True. This optional Boolean defaults to False and has the choices False and True. Leave it off to search only the selected folder; turn it on when your collection is organized into nested directories. Searching recursively may include more files, although the underlying scan has a file limit.

Load Image From Folder Output Parameters:

IMAGE

The selected image, ready to connect to another image-processing node. It is an RGB image tensor with one image in the batch and dimensions [1, H, W, 3]: height and width reflect the loaded image after any orientation correction, and the three channels hold red, green, and blue values. Pixel values are scaled to the range 0 to 1. The node does not resize the image, so its dimensions may differ from one selected file to another. Transparency is supplied separately through MASK rather than retained as a fourth image channel.

MASK

A mask derived from the selected image’s alpha channel, if it has one. Its dimensions are [1, H, W]. The node inverts alpha, so a fully transparent pixel has a mask value of 1 and a fully opaque pixel has a value of 0; partial transparency falls between them. If the image has no alpha channel, the entire mask contains zeros. This lets you pass transparency information to nodes that accept a mask.

filename

The name of the selected file, including its extension but excluding its folder path. Use it when you need to identify which source image was loaded without displaying its full location.

filepath

The selected file’s path, usually expressed relative to a ComfyUI directory, such as output/session/image.webp or input/image.png. Unlike filename, it includes the folder location, making it more useful when different folders contain files with the same name.

index

The position of the selected image in the current ordered list, starting at 0. This is the effective index after wraparound, not necessarily the number entered in the index input. For example, if five images are found and you enter 7, this output is 2.

total_images

The number of supported images found for this run’s file list. Use it with the output index to see where the selected image sits in the collection. A direct image file path produces a total of 1.

Load Image From Folder Usage Tips:

  • For a predictable sequence of images, use filenames that sort in your intended order, select name, and advance index between queued runs. The index wraps around when it reaches the end of the list.
  • To start at the other end of a name- or date-ordered collection, turn on reverse. Leave it off for random, where it does not change the shuffled order.
  • Keep subfolders off when the images you need are all in one folder. Turn it on only when you want to include nested folders; a recursive search can examine more files and is subject to the scan limit.
  • Use a direct file path when you always want the same image. Use a folder path with index when you want to step through a collection.
  • Check total_images and the output index when a queued run loads a different image than expected. The count shows how many images were found, while the output index shows the position actually selected.
  • Connect MASK when transparency matters to the next step. For an image without an alpha channel, the mask is all zeros.

Load Image From Folder Common Errors and Solutions:

Invalid or disallowed path: '`{path}`'. Path must be located inside ComfyUI 'input' or 'output' directory.

  • Explanation: The node could not resolve the path to an allowed location. This can happen with a malformed path or an absolute path outside the permitted directories.
  • Solution: Select a folder from the path dropdown, or use a valid path beneath ComfyUI’s input or output directory. Check for spelling mistakes and unintended extra path components.

Access denied: '`{path}`' is outside allowed directories (input/output).

  • Explanation: The resolved path failed the node’s allowed-directory check. A path that appears to be inside an allowed folder may also resolve elsewhere through a symbolic link.
  • Solution: Move the image into an allowed ComfyUI directory and point the node to that location. Avoid links that lead outside the allowed directories.

Path does not exist: '`{path}`' or Path does not exist: {path}

  • Explanation: The path resolves to an allowed location, but the folder or file is not present there. The wording varies depending on when the problem is detected.
  • Solution: Confirm that the file or folder exists at the specified location. For a relative path, remember that the node checks output before input; use an explicit input/ or output/ prefix when you need to identify which one you mean.

No valid images found in: {path}

  • Explanation: The folder exists, but the scan found no files with a supported image extension. This can also occur when the images are only in nested folders and subfolders is off, or when a direct file path has an unsupported extension.
  • Solution: Check that the folder contains supported image files, enable subfolders if needed, or point path directly to a supported image. If a very large collection is involved, consider using a smaller folder because the scan has a file limit.

Image opening or decoding error

  • Explanation: A file can have a supported extension yet still fail when the image library opens or reads it, for example if the file is damaged or its contents do not match its extension. The exact error message depends on the image library and file.
  • Solution: Try opening the selected file in an image editor. If it fails there, repair or replace it; otherwise, export a fresh copy in a supported format and try that copy in the node.

Load Image From Folder Related Nodes

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

Load Image From Folder