This commit is contained in:
molbal 2026-01-27 05:09:52 +01:00 committed by GitHub
commit 3d423fed35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1695,19 +1695,24 @@ class PreviewImage(SaveImage):
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
}
class LoadImage:
@classmethod
def INPUT_TYPES(s):
input_dir = folder_paths.get_input_directory()
files = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f))]
files = folder_paths.filter_files_content_types(files, ["image"])
image_paths = []
for root, _, files in os.walk(input_dir, followlinks=True):
image_files = folder_paths.filter_files_content_types(files, ["image"])
for image_file in image_files:
path_relative = os.path.relpath(os.path.join(root, image_file), input_dir)
path_relative = path_relative.replace('\\', '/')
image_paths.append(path_relative)
return {"required":
{"image": (sorted(files), {"image_upload": True})},
{"image": (sorted(list(set(image_paths))), {"image_upload": True})},
}
CATEGORY = "image"
SEARCH_ALIASES = ["load image", "open image", "import image", "image input", "upload image", "read image", "image loader"]
RETURN_TYPES = ("IMAGE", "MASK")
FUNCTION = "load_image"
def load_image(self, image):