From 673d75862532f9df3a6bf419936d8da2e0d45e69 Mon Sep 17 00:00:00 2001 From: bymyself Date: Tue, 11 Feb 2025 00:34:39 -0700 Subject: [PATCH] add LoadImageOutput node --- nodes.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/nodes.py b/nodes.py index 7defb60b..ed3787a7 100644 --- a/nodes.py +++ b/nodes.py @@ -1763,6 +1763,35 @@ class LoadImageMask: return True + +class LoadImageOutput(LoadImage): + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "image": ([], { + "image_upload": True, + "image_folder": "output", + "remote": { + "route": "/internal/files/output", + "refresh_button": True, + "control_after_refresh": "first", + }, + }), + } + } + + DESCRIPTION = "Load an image from the output folder. When the refresh button is clicked, the node will update the image list and automatically select the first image, allowing for easy iteration." + FUNCTION = "load_image_output" + + def load_image_output(self, image): + return self.load_image(f"{image} [output]") + + @classmethod + def VALIDATE_INPUTS(s, image): + return True + + class ImageScale: upscale_methods = ["nearest-exact", "bilinear", "area", "bicubic", "lanczos"] crop_methods = ["disabled", "center"] @@ -1949,6 +1978,7 @@ NODE_CLASS_MAPPINGS = { "PreviewImage": PreviewImage, "LoadImage": LoadImage, "LoadImageMask": LoadImageMask, + "LoadImageOutput": LoadImageOutput, "ImageScale": ImageScale, "ImageScaleBy": ImageScaleBy, "ImageInvert": ImageInvert, @@ -2049,6 +2079,7 @@ NODE_DISPLAY_NAME_MAPPINGS = { "PreviewImage": "Preview Image", "LoadImage": "Load Image", "LoadImageMask": "Load Image (as Mask)", + "LoadImageOutput": "Load Image (from Outputs)", "ImageScale": "Upscale Image", "ImageScaleBy": "Upscale Image By", "ImageUpscaleWithModel": "Upscale Image (using Model)",