Unverified Commit 1d2204d3 authored by Heavenn's avatar Heavenn Committed by GitHub
Browse files

Modify apply_overlay for inpainting with padding_mask_crop (Inpainting area: "Only Masked") (#8793)



* Modify apply_overlay for inpainting

* style

---------
Co-authored-by: default avatarroot <root@debian>
Co-authored-by: default avatarÁlvaro Somoza <asomoza@users.noreply.github.com>
Co-authored-by: default avataryiyixuxu <yixu310@gmail.com>
parent d38c50c8
...@@ -795,13 +795,11 @@ class VaeImageProcessor(ConfigMixin): ...@@ -795,13 +795,11 @@ class VaeImageProcessor(ConfigMixin):
The final image with the overlay applied. The final image with the overlay applied.
""" """
width, height = image.width, image.height width, height = init_image.width, init_image.height
init_image = self.resize(init_image, width=width, height=height)
mask = self.resize(mask, width=width, height=height)
init_image_masked = PIL.Image.new("RGBa", (width, 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.paste(init_image.convert("RGBA").convert("RGBa"), mask=ImageOps.invert(mask.convert("L")))
init_image_masked = init_image_masked.convert("RGBA") init_image_masked = init_image_masked.convert("RGBA")
if crop_coords is not None: if crop_coords is not None:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment