aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSplendide Imaginarius <119545140+Splendide-Imaginarius@users.noreply.github.com>2023-08-05 04:54:23 +0000
committerSplendide Imaginarius <119545140+Splendide-Imaginarius@users.noreply.github.com>2023-08-05 04:54:23 +0000
commit56888644a67298253260eda84ceb2d6cd0ce5099 (patch)
treeb21b592cceffc1f6cfcc82cbad14a14a20486905
parenta1825ee741bb21b35561d58db8cb316d7f5d0c79 (diff)
Reduce mask blur kernel size to 2.5 sigmas
This more closely matches the old behavior of PIL's Gaussian blur, and fixes breakage when tiling. See https://github.com/Coyote-A/ultimate-upscale-for-automatic1111/issues/111#issuecomment-1663504109 Thanks to Алексей Трофимов and eunnone for reporting the issue.
-rwxr-xr-xmodules/processing.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/processing.py b/modules/processing.py
index 44d20fb7..63cd025c 100755
--- a/modules/processing.py
+++ b/modules/processing.py
@@ -1275,13 +1275,13 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
if self.mask_blur_x > 0:
np_mask = np.array(image_mask)
- kernel_size = 2 * int(4 * self.mask_blur_x + 0.5) + 1
+ kernel_size = 2 * int(2.5 * self.mask_blur_x + 0.5) + 1
np_mask = cv2.GaussianBlur(np_mask, (kernel_size, 1), self.mask_blur_x)
image_mask = Image.fromarray(np_mask)
if self.mask_blur_y > 0:
np_mask = np.array(image_mask)
- kernel_size = 2 * int(4 * self.mask_blur_y + 0.5) + 1
+ kernel_size = 2 * int(2.5 * self.mask_blur_y + 0.5) + 1
np_mask = cv2.GaussianBlur(np_mask, (1, kernel_size), self.mask_blur_y)
image_mask = Image.fromarray(np_mask)