Skip to content

Commit

Permalink
UPDATE: RGBA support for Extras Single Image
Browse files Browse the repository at this point in the history
+VersionUP (0.7.0 beta6)
  • Loading branch information
Gourieff committed Mar 8, 2024
1 parent e215bd6 commit 99b0f19
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_NEW_EN.png?raw=true" alt="logo" width="180px"/>

![Version](https://img.shields.io/badge/version-0.7.0_beta5-green?style=for-the-badge&labelColor=darkgreen)
![Version](https://img.shields.io/badge/version-0.7.0_beta6-green?style=for-the-badge&labelColor=darkgreen)

<a href="https://boosty.to/artgourieff" target="_blank">
<img src="https://lovemet.ru/www/boosty.jpg" width="108" alt="Support Me on Boosty"/>
Expand Down
2 changes: 1 addition & 1 deletion README_RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<img src="https://github.com/Gourieff/Assets/raw/main/sd-webui-reactor/ReActor_logo_NEW_RU.png?raw=true" alt="logo" width="180px"/>

![Version](https://img.shields.io/badge/версия-0.7.0_beta5-green?style=for-the-badge&labelColor=darkgreen)
![Version](https://img.shields.io/badge/версия-0.7.0_beta6-green?style=for-the-badge&labelColor=darkgreen)

<a href="https://boosty.to/artgourieff" target="_blank">
<img src="https://lovemet.ru/www/boosty.jpg" width="108" alt="Поддержать проект на Boosty"/>
Expand Down
16 changes: 16 additions & 0 deletions scripts/reactor_faceswap.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,15 @@ def process(self, pp: scripts_postprocessing.PostprocessedImage, **args):
logger.status("Working: source face index %s, target face index %s", self.source_faces_index, self.faces_index)
# if self.select_source != 2:
image: Image.Image = pp.image

# Extract alpha channel
logger.debug(f"image = {image}")
if image.mode == 'RGBA':
_, _, _, alpha = image.split()
else:
alpha = None
logger.debug(f"alpha = {alpha}")

result, output, swapped = swap_face(
self.source,
image,
Expand Down Expand Up @@ -686,6 +695,13 @@ def process(self, pp: scripts_postprocessing.PostprocessedImage, **args):
else:
try:
pp.info["ReActor"] = True

if alpha is not None:
logger.debug(f"result = {result}")
result = result.convert("RGBA")
result.putalpha(alpha)
logger.debug(f"result_alpha = {result}")

pp.image = result
logger.status("---Done!---")
except Exception:
Expand Down
2 changes: 1 addition & 1 deletion scripts/reactor_version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app_title = "ReActor"
version_flag = "v0.7.0-b5"
version_flag = "v0.7.0-b6"

from scripts.reactor_logger import logger, get_Run, set_Run
from scripts.reactor_globals import DEVICE
Expand Down

0 comments on commit 99b0f19

Please sign in to comment.