Skip to content

Commit

Permalink
Modify apply_overlay for inpainting with padding_mask_crop (Inpaintin…
Browse files Browse the repository at this point in the history
…g area: "Only Masked") (huggingface#8793)

* Modify apply_overlay for inpainting

* style

---------

Co-authored-by: root <root@debian>
Co-authored-by: Álvaro Somoza <[email protected]>
Co-authored-by: yiyixuxu <[email protected]>
  • Loading branch information
4 people authored Nov 17, 2024
1 parent d38c50c commit 1d2204d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/diffusers/image_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,13 +795,11 @@ def apply_overlay(
The final image with the overlay applied.
"""

width, height = image.width, image.height

init_image = self.resize(init_image, width=width, height=height)
mask = self.resize(mask, width=width, height=height)
width, height = init_image.width, init_image.height

init_image_masked = PIL.Image.new("RGBa", (width, height))
init_image_masked.paste(init_image.convert("RGBA").convert("RGBa"), mask=ImageOps.invert(mask.convert("L")))

init_image_masked = init_image_masked.convert("RGBA")

if crop_coords is not None:
Expand Down

0 comments on commit 1d2204d

Please sign in to comment.