diff options
author | CodeHatchling <steve@codehatch.com> | 2023-11-28 23:13:42 +0000 |
---|---|---|
committer | CodeHatchling <steve@codehatch.com> | 2023-11-28 23:13:42 +0000 |
commit | a6e584645305c0a91a3d46f73546e191b249210f (patch) | |
tree | 9e8ca90c5b9b441d2c3dedff6f9016f762e59ac0 /modules/processing.py | |
parent | e715e46b6aa7f2e5e147cfa1fa2f49b1d926a074 (diff) | |
download | stable-diffusion-webui-gfx803-a6e584645305c0a91a3d46f73546e191b249210f.tar.gz stable-diffusion-webui-gfx803-a6e584645305c0a91a3d46f73546e191b249210f.tar.bz2 stable-diffusion-webui-gfx803-a6e584645305c0a91a3d46f73546e191b249210f.zip |
Nerfs the aggressive post-processing step of overlaying the original image.
Diffstat (limited to 'modules/processing.py')
-rw-r--r-- | modules/processing.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/modules/processing.py b/modules/processing.py index ae894f1a..12e08e87 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -1412,7 +1412,12 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing): image_mask = Image.fromarray(np_mask)
if self.inpaint_full_res:
- self.mask_for_overlay = image_mask
+ np_mask = np.array(image_mask).astype(np.float32)
+ np_mask /= 255
+ np_mask = 1-pow(1-np_mask, 100)
+ np_mask *= 255
+ np_mask = np.clip(np_mask, 0, 255).astype(np.uint8)
+ self.mask_for_overlay = Image.fromarray(np_mask)
mask = image_mask.convert('L')
crop_region = masking.get_crop_region(np.array(mask), self.inpaint_full_res_padding)
crop_region = masking.expand_crop_region(crop_region, self.width, self.height, mask.width, mask.height)
@@ -1423,8 +1428,11 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing): self.paste_to = (x1, y1, x2-x1, y2-y1)
else:
image_mask = images.resize_image(self.resize_mode, image_mask, self.width, self.height)
- np_mask = np.array(image_mask)
- np_mask = np.clip((np_mask.astype(np.float32)) * 2, 0, 255).astype(np.uint8)
+ np_mask = np.array(image_mask).astype(np.float32)
+ np_mask /= 255
+ np_mask = 1-pow(1-np_mask, 100)
+ np_mask *= 255
+ np_mask = np.clip(np_mask, 0, 255).astype(np.uint8)
self.mask_for_overlay = Image.fromarray(np_mask)
self.overlay_images = []
|