This commit is contained in:
Andray 2025-12-22 01:00:12 -05:00 committed by GitHub
commit 5fce6af6e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View file

@ -65,8 +65,19 @@ def apply_color_correction(correction, original_image):
def uncrop(image, dest_size, paste_loc):
x, y, w, h = paste_loc
base_image = Image.new('RGBA', dest_size)
if image.width > shared.opts.img2img_inpaint_correct_paste_xy_side_length_threshold:
paste_x = max(x - w // image.width, 0)
else:
paste_x = x
if image.height > shared.opts.img2img_inpaint_correct_paste_xy_side_length_threshold:
paste_y = max(y - h // image.height, 0)
else:
paste_y = y
image = images.resize_image(1, image, w, h)
base_image.paste(image, (x, y))
base_image.paste(image, (paste_x, paste_y))
image = base_image
return image