Update image_nodes.py

This commit is contained in:
kijai 2025-05-29 20:35:18 +03:00
parent b95b79ee82
commit 9a52b7dfd2

View File

@ -2662,8 +2662,8 @@ class LoadImagesFromFolderKJ:
return { return {
"required": { "required": {
"folder": ("STRING", {"default": ""}), "folder": ("STRING", {"default": ""}),
"width": ("INT", {"default": 1024, "min": 64, "step": 1}), "width": ("INT", {"default": 1024, "min": -1, "step": 1}),
"height": ("INT", {"default": 1024, "min": 64, "step": 1}), "height": ("INT", {"default": 1024, "min": -1, "step": 1}),
"keep_aspect_ratio": (["crop", "pad", "stretch",],), "keep_aspect_ratio": (["crop", "pad", "stretch",],),
}, },
"optional": { "optional": {
@ -2721,6 +2721,9 @@ class LoadImagesFromFolderKJ:
i = ImageOps.exif_transpose(i) i = ImageOps.exif_transpose(i)
# Resize image to maximum dimensions # Resize image to maximum dimensions
if width == -1 and height == -1:
width = i.size[0]
height = i.size[1]
if i.size != (width, height): if i.size != (width, height):
i = self.resize_with_aspect_ratio(i, width, height, keep_aspect_ratio) i = self.resize_with_aspect_ratio(i, width, height, keep_aspect_ratio)