From f1d4b4f7d130e0d37004c6e855db70b2115d59e7 Mon Sep 17 00:00:00 2001 From: jaesimio <160267215+jaesimio@users.noreply.github.com> Date: Wed, 20 Mar 2024 02:08:03 +0900 Subject: [PATCH] fix bug in apply mask --- scripts/faceswaplab_utils/imgutils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/faceswaplab_utils/imgutils.py b/scripts/faceswaplab_utils/imgutils.py index 0112ece..2521e2a 100644 --- a/scripts/faceswaplab_utils/imgutils.py +++ b/scripts/faceswaplab_utils/imgutils.py @@ -221,7 +221,13 @@ def apply_mask( img.paste(overlay, (0, 0), overlay) return img - img = processing.apply_overlay(img, p.paste_to, batch_index, p.overlay_images) + if p.overlay_images and batch_index < len(p.overlay_images): + selected_overlay = p.overlay_images[batch_index] + img, _ = processing.apply_overlay(img, p.paste_to, selected_overlay) + else: + logger.debug("No overlay selected or overlay list is empty.") + return img + if p.color_corrections is not None and batch_index < len(p.color_corrections): img = processing.apply_color_correction( p.color_corrections[batch_index], img -- 2.52.0