LoadImage node now scans subdirectories for images #12099
+9
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

This pull request addresses the limitation of the LoadImage node, which currently only searches for images in the root of the input directory.
The LoadImage node was enhanced to recursively scan the input directory and all of its subdirectories for image files. This brings its behavior in line with other loader nodes (like Load Checkpoint) and allows users to better organize their input files into folders.
The implementation was changed from using os.listdir to os.walk within the INPUT_TYPES method to build the file list. The file paths displayed in the dropdown menu now include their relative path from the input directory (e.g., mydirectory/myimage.png), making them easy to identify.
I tested this change by:
This simply expands the search scope for files and uses existing path-handling functions. Performance impact should be negligible unless the input directory contains an exceptionally large number of files and folders.