diff --git a/README.MD b/README.MD
index 0a964c5..9ff5095 100644
--- a/README.MD
+++ b/README.MD
@@ -147,6 +147,7 @@ When this error has occurred, please check the network environment.
**If the dependency package error after updating, please double clicking ```repair_dependency.bat``` (for Official ComfyUI Protable) or ```repair_dependency_aki.bat``` (for ComfyUI-aki-v1.x) in the plugin folder to reinstall the dependency packages.
+* Commit [DrawRoundedRectangle](#DrawRoundedRectangle) node, used to generate rounded rectangle masks.
* Commit [FluxKontextImageScale](#FluxKontextImageScale) node, based on official node modifications, used to resizes the image to one that is more optimal for flux kontext. For images with different aspect ratio, the scale will be adjusted appropriately to maintain all information.
* Commit [MaskBoxExtend](#MaskBoxExtend) node, used to generate BBOX mask extension range and output as Mask.
* Commit [ColorNegative](#ColorNegative) node, used to invert the color of image.
@@ -2274,6 +2275,20 @@ Node Options:
* grain: Noise intensity.
* invert_mask: Whether to reverse the mask.
+### DrawRoundedRectangle
+Generate rounded rectangular borders for the mask.
+
+Node Options:
+
+
+* size_as*: Reference size. It can be an image or a mask.
+* rounded_rect_radius: Rounded rectangle radius.
+* anti_aliasing: Anti aliasing sampling multiple.
+* width: Mask width. If size_as is entered, this setting will be ignored.
+* height: Mask height. If size_as is entered, this setting will be ignored.
+
+*Only limited to input images and masks. forcing the integration of other types of inputs will result in node errors.
+
### MaskPreview
Preview the input mask
diff --git a/README_CN.MD b/README_CN.MD
index 1ec4a0e..f205f95 100644
--- a/README_CN.MD
+++ b/README_CN.MD
@@ -128,6 +128,7 @@ os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
## 更新说明
**如果本插件更新后出现依赖包错误,请双击运行插件目录下的```install_requirements.bat```(官方便携包),或 ```install_requirements_aki.bat```(秋叶整合包) 重新安装依赖包。
+* 添加 [DrawRoundedRectangle](#DrawRoundedRectangle) 节点, 用于生成圆角矩形遮罩。
* 添加 [FluxKontextImageScale](#FluxKontextImageScale) 节点,基于官方节点修改,用于将图像大小调整为更适合FluxKontext的大小。对于非标准宽高比的图像,自动调整比例以保持所有画面信息。
* 添加 [MaskBoxExtend](#MaskBoxExtend) 节点,用于生成遮罩BBOX扩展范围并输出为Mask。
* 添加 [ColorNegative](#ColorNegative)节点,用于将图片颜色反转。
@@ -2036,6 +2037,20 @@ MaskGrow与MaskEdgeShrink效果对比
* grain: 噪声强度。
* invert_mask: 是否反转遮罩。
+### DrawRoundedRectangle
+为遮罩生成圆角矩形边框。
+
+节点选项说明:
+
+
+* size_as*: 参考大小。可以是图像image,也可以是遮罩mask。
+* rounded_rect_radius: 圆角矩形半径。
+* anti_aliasing: 抗锯齿采样倍数。
+* width: 遮罩宽度。如果size_as输入,此设置将被忽略。
+* height: 遮罩高度。如果size_as输入,此设置将被忽略。
+
+*仅限输入image和mask, 如果强制接入其他类型输入,将导致节点错误。
+
### MaskPreview
预览mask

@@ -2045,6 +2060,7 @@ mask反转

+
# LayerFilter

diff --git a/image/draw_rounded_rectangle_node.jpg b/image/draw_rounded_rectangle_node.jpg
new file mode 100644
index 0000000..cf78e54
Binary files /dev/null and b/image/draw_rounded_rectangle_node.jpg differ
diff --git a/py/draw_mask.py b/py/draw_mask.py
index ab35da3..f9b977a 100644
--- a/py/draw_mask.py
+++ b/py/draw_mask.py
@@ -14,11 +14,13 @@ class LS_DrawRoundedRectangle:
def INPUT_TYPES(cls):
return {
"required": {
- "size_as": (any, {}),
"rounded_rect_radius": ("INT", {"default": 50, "min": 0, "max": 100, "step": 1}),
"anti_aliasing": ("INT", {"default": 2, "min": 0, "max": 16, "step": 1}),
+ "width": ("INT", {"default": 1024, "min": 8, "max": 1e8, "step": 1}),
+ "height": ("INT", {"default": 1024, "min": 8, "max": 1e8, "step": 1}),
},
"optional": {
+ "size_as": (any, {}),
}
}
@@ -27,16 +29,19 @@ class LS_DrawRoundedRectangle:
FUNCTION = 'draw_rounded_rectangle'
CATEGORY = '😺dzNodes/LayerMask'
- def draw_rounded_rectangle(self, size_as, rounded_rect_radius, anti_aliasing):
+ def draw_rounded_rectangle(self, rounded_rect_radius, anti_aliasing, width, height, size_as=None,):
- if size_as.shape[0] > 0:
- _asimage = tensor2pil(size_as[0])
+ if size_as is None:
+ target_width, target_height = width, height
else:
- _asimage = tensor2pil(size_as)
- target_width, target_height = _asimage.size
+ if size_as.shape[0] > 0:
+ _asimage = tensor2pil(size_as[0])
+ else:
+ _asimage = tensor2pil(size_as)
+ target_width, target_height = _asimage.size
ret_masks = []
- mask = Image.new("L", _asimage.size, color='black')
+ mask = Image.new("L", (target_width, target_height), color='black')
bboxes = [(0, 0, target_width, target_height)]
mask = draw_rounded_rectangle(mask, rounded_rect_radius, bboxes, anti_aliasing)
ret_masks.append(pil2tensor(mask))
diff --git a/pyproject.toml b/pyproject.toml
index 0dbed25..60b49a8 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,7 +1,7 @@
[project]
name = "comfyui_layerstyle"
description = "A set of nodes for ComfyUI it generate image like Adobe Photoshop's Layer Style. the Drop Shadow is first completed node, and follow-up work is in progress."
-version = "2.0.24"
+version = "2.0.26"
license = {text = "MIT License"}
dependencies = ["numpy", "pillow", "torch", "matplotlib", "Scipy", "scikit_image", "scikit_learn", "opencv-contrib-python", "pymatting", "timm", "colour-science", "transformers", "blend_modes", "huggingface_hub", "loguru"]