From 2a09d97633300ba7aa3167b5b2d2bb9e22e0df8f Mon Sep 17 00:00:00 2001 From: Dontdrunk <1761696257@qq.com> Date: Sun, 27 Jul 2025 10:55:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=85=B3=E9=97=AD=E9=81=AE?= =?UTF-8?q?=E7=BD=A9=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=9B=B4=E7=81=B5=E6=B4=BB?= =?UTF-8?q?=E7=9A=84=E5=A4=84=E7=90=86=E9=80=8F=E6=98=8E=E5=92=8C=E9=9D=9E?= =?UTF-8?q?=E9=80=8F=E6=98=8E=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/en/nodeDefs.json | 6 +++--- locales/zh/nodeDefs.json | 6 +++--- node/image_stroke.py | 8 +++++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/locales/en/nodeDefs.json b/locales/en/nodeDefs.json index 6fc0946..0043c5d 100644 --- a/locales/en/nodeDefs.json +++ b/locales/en/nodeDefs.json @@ -315,9 +315,9 @@ "name": "Image", "tooltip": "Input image to add stroke effect" }, - "反转遮罩": { - "name": "Invert Mask", - "tooltip": "Whether to invert mask effect, enabled by default" + "关闭遮罩": { + "name": "Disable Mask", + "tooltip": "Disable mask input when enabled" }, "位置": { "name": "Position", diff --git a/locales/zh/nodeDefs.json b/locales/zh/nodeDefs.json index d7b3177..efe821b 100644 --- a/locales/zh/nodeDefs.json +++ b/locales/zh/nodeDefs.json @@ -315,9 +315,9 @@ "name": "图片", "tooltip": "需要添加描边的输入图片" }, - "反转遮罩": { - "name": "反转遮罩", - "tooltip": "是否反转遮罩效果,默认开启" + "关闭遮罩": { + "name": "关闭遮罩", + "tooltip": "开启后将关闭遮罩输入" }, "位置": { "name": "位置", diff --git a/node/image_stroke.py b/node/image_stroke.py index 462394c..10d143c 100644 --- a/node/image_stroke.py +++ b/node/image_stroke.py @@ -14,6 +14,7 @@ class DDImageStroke: return { "required": { "图片": ("IMAGE",), + "关闭遮罩": ("BOOLEAN", {"default": False}), "位置": (["外描边", "内描边", "居中描边"], {"default": "外描边"}), "大小": ("INT", {"default": 5, "min": 1, "max": 200, "step": 1}), "不透明度": ("INT", {"default": 100, "min": 1, "max": 100, "step": 1}), @@ -249,12 +250,13 @@ class DDImageStroke: return result - def add_stroke(self, 图片, 位置, 大小, 不透明度, 描边颜色, 遮罩=None): + def add_stroke(self, 图片, 关闭遮罩, 位置, 大小, 不透明度, 描边颜色, 遮罩=None): """ 为图片添加描边效果 Args: 图片: 输入图片tensor + 关闭遮罩: 是否关闭遮罩功能(True时忽略遮罩输入) 位置: 描边位置("外描边", "内描边", "居中描边") 大小: 描边大小(像素) 不透明度: 描边不透明度(1-100) @@ -270,9 +272,9 @@ class DDImageStroke: results = [] for i in range(batch_size): - # 获取对应的遮罩(如果有) + # 获取对应的遮罩(如果有且未关闭遮罩功能) current_mask = None - if 遮罩 is not None: + if not 关闭遮罩 and 遮罩 is not None: if len(遮罩.shape) == 3 and 遮罩.shape[0] > i: current_mask = 遮罩[i:i+1] elif len(遮罩.shape) == 2: