From 5c70d766b7e852aa0a27a666abca15e273df9359 Mon Sep 17 00:00:00 2001 From: Sirshendu Ganguly Date: Thu, 21 May 2026 17:05:53 +0530 Subject: [PATCH] Fixed conditional blocks in imageInference --- modules/imageInference.py | 2 +- modules/outpaintSettings.py | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/modules/imageInference.py b/modules/imageInference.py index f31e520..7678954 100644 --- a/modules/imageInference.py +++ b/modules/imageInference.py @@ -351,7 +351,7 @@ class txt2img: genConfig[0]["embeddings"] = runwareEmbedding elif (isinstance(runwareEmbedding, dict)): genConfig[0]["embeddings"] = [runwareEmbedding] - if (runwareOutpainting is not None): + if runwareOutpainting: genConfig[0]["outpaint"] = runwareOutpainting if (runwareVAE is not None): genConfig[0]["vae"] = runwareVAE diff --git a/modules/outpaintSettings.py b/modules/outpaintSettings.py index 946a2f1..bc4de40 100644 --- a/modules/outpaintSettings.py +++ b/modules/outpaintSettings.py @@ -1,3 +1,8 @@ +def _round_to_multiple_of_64(value: int) -> int: + """Round pixel extension to the nearest multiple of 64 (API constraint).""" + return max(0, min(2048, round(value / 64) * 64)) + + class outpaintSettings: @classmethod def INPUT_TYPES(cls): @@ -10,7 +15,7 @@ class outpaintSettings: "Top": ( "INT", { - "tooltip": "Number of pixels to extend at the top of the image. Must be a multiple of 64. Only used when 'Use Top' is enabled.", + "tooltip": "Number of pixels to extend at the top of the image. Rounded to the nearest multiple of 64 when sent to the API. Only used when 'Use Top' is enabled.", "default": 64, "min": 0, "max": 2048, @@ -24,7 +29,7 @@ class outpaintSettings: "Right": ( "INT", { - "tooltip": "Number of pixels to extend at the right of the image. Must be a multiple of 64. Only used when 'Use Right' is enabled.", + "tooltip": "Number of pixels to extend at the right of the image. Rounded to the nearest multiple of 64 when sent to the API. Only used when 'Use Right' is enabled.", "default": 64, "min": 0, "max": 2048, @@ -38,7 +43,7 @@ class outpaintSettings: "Bottom": ( "INT", { - "tooltip": "Number of pixels to extend at the bottom of the image. Must be a multiple of 64. Only used when 'Use Bottom' is enabled.", + "tooltip": "Number of pixels to extend at the bottom of the image. Rounded to the nearest multiple of 64 when sent to the API. Only used when 'Use Bottom' is enabled.", "default": 64, "min": 0, "max": 2048, @@ -52,7 +57,7 @@ class outpaintSettings: "Left": ( "INT", { - "tooltip": "Number of pixels to extend at the left of the image. Must be a multiple of 64. Only used when 'Use Left' is enabled.", + "tooltip": "Number of pixels to extend at the left of the image. Rounded to the nearest multiple of 64 when sent to the API. Only used when 'Use Left' is enabled.", "default": 64, "min": 0, "max": 2048, @@ -86,14 +91,14 @@ class outpaintSettings: outpaint = {} if kwargs.get("useTop", False): - outpaint["top"] = int(kwargs.get("Top", 0)) + outpaint["top"] = _round_to_multiple_of_64(int(kwargs.get("Top", 0))) if kwargs.get("useRight", False): - outpaint["right"] = int(kwargs.get("Right", 0)) + outpaint["right"] = _round_to_multiple_of_64(int(kwargs.get("Right", 0))) if kwargs.get("useBottom", False): - outpaint["bottom"] = int(kwargs.get("Bottom", 0)) + outpaint["bottom"] = _round_to_multiple_of_64(int(kwargs.get("Bottom", 0))) if kwargs.get("useLeft", False): - outpaint["left"] = int(kwargs.get("Left", 0)) + outpaint["left"] = _round_to_multiple_of_64(int(kwargs.get("Left", 0))) if kwargs.get("useBlur", False): outpaint["blur"] = int(kwargs.get("Blur", 0)) - return (outpaint,) + return (outpaint if outpaint else None,)