From 8a2ea3fa79c82fc14ba8688c76a776f3a6d0c148 Mon Sep 17 00:00:00 2001 From: tombearx <162094659+tombearx@users.noreply.github.com> Date: Thu, 29 Aug 2024 07:44:11 +0300 Subject: [PATCH] Fix ImagePadForOutpaintTargetSize There is an error in the code: If scale factor is equal 1, then padding should calculated as difference between target and current sizes. Now padding is just target size. --- nodes/image_nodes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nodes/image_nodes.py b/nodes/image_nodes.py index 1701752..13a5794 100644 --- a/nodes/image_nodes.py +++ b/nodes/image_nodes.py @@ -1030,8 +1030,8 @@ class ImagePadForOutpaintTargetSize: def expand_image(self, image, target_width, target_height, feathering, upscale_method, mask=None): B, H, W, C = image.size() - new_height = 0 - new_width = 0 + new_height = H + new_width = W # Calculate the scaling factor while maintaining aspect ratio scaling_factor = min(target_width / W, target_height / H) @@ -1938,4 +1938,4 @@ class ImageGridtoBatch: # Reshape to the final batch tensor img_tensor = image.view(-1, orig_h, orig_w, C) - return img_tensor, \ No newline at end of file + return img_tensor,