aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-09-06 21:58:01 +0000
committerAUTOMATIC <16777216c@gmail.com>2022-09-06 21:58:01 +0000
commita8504157a02e61d787a2b924f4f8de6f578f0aac (patch)
treebf5e9049b2db6a9430c53c597d926b819a70760f
parent7ce7fb01e035a7ba8ca9cb35784cd75cca3d99fd (diff)
downloadstable-diffusion-webui-gfx803-a8504157a02e61d787a2b924f4f8de6f578f0aac.tar.gz
stable-diffusion-webui-gfx803-a8504157a02e61d787a2b924f4f8de6f578f0aac.tar.bz2
stable-diffusion-webui-gfx803-a8504157a02e61d787a2b924f4f8de6f578f0aac.zip
some changes for outpainting to produce less seams
-rw-r--r--modules/processing.py4
-rw-r--r--scripts/poor_mans_outpainting.py2
2 files changed, 4 insertions, 2 deletions
diff --git a/modules/processing.py b/modules/processing.py
index e615ffdc..23fe54d1 100644
--- a/modules/processing.py
+++ b/modules/processing.py
@@ -342,7 +342,9 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
self.paste_to = (x1, y1, x2-x1, y2-y1)
else:
self.image_mask = images.resize_image(self.resize_mode, self.image_mask, self.width, self.height)
- self.mask_for_overlay = self.image_mask
+ np_mask = np.array(self.image_mask)
+ np_mask = 255 - np.clip((255 - np_mask.astype(np.float)) * 2, 0, 255).astype(np.uint8)
+ self.mask_for_overlay = Image.fromarray(np_mask)
self.overlay_images = []
diff --git a/scripts/poor_mans_outpainting.py b/scripts/poor_mans_outpainting.py
index d0f6a2fc..08171877 100644
--- a/scripts/poor_mans_outpainting.py
+++ b/scripts/poor_mans_outpainting.py
@@ -67,7 +67,7 @@ class Script(scripts.Script):
latent_mask = Image.new("L", (img.width, img.height), "white")
latent_draw = ImageDraw.Draw(latent_mask)
- latent_draw.rectangle((left + 1, up + 1, mask.width - right - 1, mask.height - down - 1), fill="black")
+ latent_draw.rectangle((left + left//2, up + up//2, mask.width - right - right//2, mask.height - down - down//2), fill="black")
processing.torch_gc()