mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2026-01-31 04:42:09 -08:00
Merge 56d79f6dc2 into fd68e0c384
This commit is contained in:
commit
efbb8637af
5 changed files with 170 additions and 6 deletions
|
|
@ -65,8 +65,12 @@ 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)
|
||||
image = images.resize_image(1, image, w, h)
|
||||
base_image.paste(image, (x, y))
|
||||
factor_x = w // image.size[0]
|
||||
factor_y = h // image.size[1]
|
||||
image = images.resize_image(1, image, w, h, preserve_colors=shared.opts.img2img_upscaler_preserve_colors)
|
||||
paste_x = max(x - factor_x, 0)
|
||||
paste_y = max(y - factor_y, 0)
|
||||
base_image.paste(image, (paste_x, paste_y))
|
||||
image = base_image
|
||||
|
||||
return image
|
||||
|
|
@ -1642,6 +1646,8 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
|
|||
crop_region = masking.get_crop_region_v2(mask, self.inpaint_full_res_padding)
|
||||
if crop_region:
|
||||
crop_region = masking.expand_crop_region(crop_region, self.width, self.height, mask.width, mask.height)
|
||||
if shared.opts.integer_only_masked:
|
||||
crop_region = masking.fix_crop_region_integer_scale(crop_region, self.width, self.height, mask.width, mask.height)
|
||||
x1, y1, x2, y2 = crop_region
|
||||
mask = mask.crop(crop_region)
|
||||
image_mask = images.resize_image(2, mask, self.width, self.height)
|
||||
|
|
@ -1680,7 +1686,7 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
|
|||
image = images.flatten(img, opts.img2img_background_color)
|
||||
|
||||
if crop_region is None and self.resize_mode != 3:
|
||||
image = images.resize_image(self.resize_mode, image, self.width, self.height)
|
||||
image = images.resize_image(self.resize_mode, image, self.width, self.height, preserve_colors=shared.opts.img2img_upscaler_preserve_colors)
|
||||
|
||||
if image_mask is not None:
|
||||
if self.mask_for_overlay.size != (image.width, image.height):
|
||||
|
|
@ -1693,7 +1699,7 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
|
|||
# crop_region is not None if we are doing inpaint full res
|
||||
if crop_region is not None:
|
||||
image = image.crop(crop_region)
|
||||
image = images.resize_image(2, image, self.width, self.height)
|
||||
image = images.resize_image(2, image, self.width, self.height, preserve_colors=shared.opts.img2img_upscaler_preserve_colors)
|
||||
|
||||
if image_mask is not None:
|
||||
if self.inpainting_fill != 1:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue