From 3e10049e846c67b9dc23b1c0e2f64416ee75af1e Mon Sep 17 00:00:00 2001 From: Dowon Date: Fri, 29 Mar 2024 21:27:32 +0900 Subject: [PATCH] fix: txt2img inpainting mask?? error --- scripts/!adetailer.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/!adetailer.py b/scripts/!adetailer.py index afe887b..09c52b8 100644 --- a/scripts/!adetailer.py +++ b/scripts/!adetailer.py @@ -667,12 +667,16 @@ class AfterDetailerScript(scripts.Script): @staticmethod def get_image_mask(p) -> Image.Image: mask = p.image_mask - if p.inpainting_mask_invert: + if getattr(p, "inpainting_mask_invert", False): mask = ImageChops.invert(mask) mask = create_binary_mask(mask) if getattr(p, "_ad_skip_img2img", False): - width, height = p.init_images[0].size + if hasattr(p, "init_images") and p.init_images: + width, height = p.init_images[0].size + else: + msg = "[-] ADetailer: no init_images." + raise RuntimeError(msg) else: width, height = p.width, p.height return images.resize_image(p.resize_mode, mask, width, height)