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.
This commit is contained in:
tombearx 2024-08-29 07:44:11 +03:00 committed by GitHub
parent 47a6da5f62
commit 8a2ea3fa79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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,
return img_tensor,