UPDATE: RGBA support for Extras Single Image

+VersionUP (0.7.0 beta6)
This commit is contained in:
Art Gourieff 2024-03-09 02:36:11 +07:00
parent e215bd6763
commit 99b0f19553
4 changed files with 19 additions and 3 deletions

View File

@ -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"/> <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"> <a href="https://boosty.to/artgourieff" target="_blank">
<img src="https://lovemet.ru/www/boosty.jpg" width="108" alt="Support Me on Boosty"/> <img src="https://lovemet.ru/www/boosty.jpg" width="108" alt="Support Me on Boosty"/>

View File

@ -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"/> <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"> <a href="https://boosty.to/artgourieff" target="_blank">
<img src="https://lovemet.ru/www/boosty.jpg" width="108" alt="Поддержать проект на Boosty"/> <img src="https://lovemet.ru/www/boosty.jpg" width="108" alt="Поддержать проект на Boosty"/>

View File

@ -651,6 +651,15 @@ class FaceSwapScriptExtras(scripts_postprocessing.ScriptPostprocessing):
logger.status("Working: source face index %s, target face index %s", self.source_faces_index, self.faces_index) logger.status("Working: source face index %s, target face index %s", self.source_faces_index, self.faces_index)
# if self.select_source != 2: # if self.select_source != 2:
image: Image.Image = pp.image 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( result, output, swapped = swap_face(
self.source, self.source,
image, image,
@ -686,6 +695,13 @@ class FaceSwapScriptExtras(scripts_postprocessing.ScriptPostprocessing):
else: else:
try: try:
pp.info["ReActor"] = True 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 pp.image = result
logger.status("---Done!---") logger.status("---Done!---")
except Exception: except Exception:

View File

@ -1,5 +1,5 @@
app_title = "ReActor" 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_logger import logger, get_Run, set_Run
from scripts.reactor_globals import DEVICE from scripts.reactor_globals import DEVICE