Skip to content

Commit

Permalink
improve mask blur effect
Browse files Browse the repository at this point in the history
  • Loading branch information
ototadana committed May 26, 2023
1 parent 75f1241 commit 674675f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Please try the following settings first:

- Set the **"Mask size"** to `0`.
- Check **"Apply inside mask only"**
- Set the **"Mask blur"** to `12`.
- Set the **"Denoising strength for the entire image"** to `0`.

![Recommended settings](./images/tips-01.png)
Expand Down
Binary file modified images/tips-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions scripts/face_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ def ui(self, is_img2img):
)
mask_size = gr.Slider(label="Mask size", minimum=0,
maximum=64, step=1, value=0)
mask_blur = gr.Slider(label="Mask blur", minimum=0,
maximum=64, step=1, value=0)
mask_blur = gr.Slider(label="Mask blur ", minimum=0,
maximum=64, step=1, value=12)
strength2 = gr.Slider(
minimum=0.0,
maximum=1.0,
Expand Down Expand Up @@ -374,6 +374,8 @@ def __proc_image(self, p: StableDiffusionProcessingImg2Img,
face.width, face.height))
mask_image = cv2.resize(mask_image, dsize=(
face.width, face.height))
if mask_blur > 0:
mask_image = cv2.blur(mask_image, (mask_blur, mask_blur))

if use_minimal_area:
l, t, r, b = face.face_area
Expand Down

1 comment on commit 674675f

@JoeyLearnsToCode
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

best extension ever!
thank you

Please sign in to comment.