Skip to content

Commit

Permalink
commit GaussianBlurV2 node
Browse files Browse the repository at this point in the history
  • Loading branch information
chflame163 committed Sep 26, 2024
1 parent 5486aa1 commit 42b3af6
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 5 deletions.
11 changes: 10 additions & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ When this error has occurred, please check the network environment.
## Update
<font size="4">**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. </font><br />


* Commit [GaussianBlurV2](#GaussianBlurV2) node, The parameter accuracy has been improved to 0.01.
* Commit [UserPromptGeneratorTxtImgWithReference](#UserPromptGeneratorTxtImgWithReference) node.
* Commit [GrayValue](#GrayValue) node, output the grayscale values corresponding to the RGB color values.
* [LUT Apply](#LUT), [TextImageV2](#TextImageV2), [TextImage](#TextImage), [SimpleTextImage](#SimpleTextImage) nodes to support defining multiple folders in ```resource-dir.ini```, separated by commas, semicolons, or spaces. Simultaneously supports refreshing real-time updates.
Expand Down Expand Up @@ -2575,7 +2577,14 @@ Make the image gaussian blur
![image](image/gaussian_blur_example.jpg)

Node options:
* blur: The size of blur.
* blur: The size of blur, integer, range 1-999.

### <a id="table1">GaussianBlurV2</a>
Gaussian blur. Change the parameter precision to floating-point number, with a precision of 0.01

Node options:
![image](image/gaussian_blur_v2_node.jpg)
* blur: The size of blur, float, range 0 - 1000.

### <a id="table1">AddGrain</a>
Add noise to the picture.
Expand Down
10 changes: 9 additions & 1 deletion README_CN.MD
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
## 更新说明
<font size="4">**如果本插件更新后出现依赖包错误,请双击运行插件目录下的```install_requirements.bat```(官方便携包),或 ```install_requirements_aki.bat```(秋叶整合包) 重新安装依赖包。

* 添加 [GaussianBlurV2](#GaussianBlurV2) 节点,参数精度提升到0.01。
* 添加 [UserPromptGeneratorTxtImgWithReference](#UserPromptGeneratorTxtImgWithReference) 节点。
* 添加 [GrayValue](#GrayValue) 节点,输出RGB色值对应的灰度值。
* [LUT Apply](#LUT), [TextImageV2](#TextImageV2), [TextImage](#TextImage), [SimpleTextImage](#SimpleTextImage) 等节点支持在 ```resource_dir.ini``` 中定义多个文件夹,之间用逗号,分号或者空格分隔。同时支持刷新实时更新。
Expand Down Expand Up @@ -2550,7 +2551,14 @@ Film节点的升级版, 在之前基础上增加了fastgrain方法,生成噪
![image](image/gaussian_blur_example.jpg)

节点选项说明:
* blur: 模糊大小。
* blur: 模糊大小。整数,范围 1-999。

### <a id="table1">GaussianBlur</a>
高斯模糊。参数精度改为浮点数,精度为0.01

节点选项说明:
![image](image/gaussian_blur_v2_node.jpg)
* blur: 模糊大小。浮点数,范围 0-1000。

### <a id="table1">AddGrain</a>
给图片增加噪声。
Expand Down
Binary file added image/gaussian_blur_v2_node.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 42 additions & 2 deletions py/gaussian_blur.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,50 @@ def gaussian_blur(self, image, blur):
log(f"{NODE_NAME} Processed {len(ret_images)} image(s).", message_type='finish')
return (torch.cat(ret_images, dim=0),)


class LS_GaussianBlurV2:

def __init__(self):
pass

@classmethod
def INPUT_TYPES(self):

return {
"required": {
"image": ("IMAGE", ), #
"blur": ("FLOAT", {"default": 20, "min": 0, "max": 1000, "step": 0.05}), # 模糊
},
"optional": {
}
}

RETURN_TYPES = ("IMAGE",)
RETURN_NAMES = ("image",)
FUNCTION = 'gaussian_blur_v2'
CATEGORY = '😺dzNodes/LayerFilter'

def gaussian_blur_v2(self, image, blur):

ret_images = []

if blur:
for i in image:
_canvas = tensor2pil(torch.unsqueeze(i, 0)).convert('RGB')

ret_images.append(pil2tensor(gaussian_blur(_canvas, blur)))
else:
return (image,)

log(f"{NODE_NAME} Processed {len(ret_images)} image(s).", message_type='finish')
return (torch.cat(ret_images, dim=0),)

NODE_CLASS_MAPPINGS = {
"LayerFilter: GaussianBlur": GaussianBlur
"LayerFilter: GaussianBlur": GaussianBlur,
"LayerFilter: GaussianBlurV2": LS_GaussianBlurV2
}

NODE_DISPLAY_NAME_MAPPINGS = {
"LayerFilter: GaussianBlur": "LayerFilter: GaussianBlur"
"LayerFilter: GaussianBlur": "LayerFilter: GaussianBlur",
"LayerFilter: GaussianBlurV2": "LayerFilter: Gaussian Blur V2"
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = "1.0.67"
version = "1.0.68"
license = "MIT"
dependencies = ["numpy", "pillow", "torch", "matplotlib", "Scipy", "scikit_image", "scikit_learn", "opencv-contrib-python", "pymatting", "segment_anything", "timm", "addict", "yapf", "colour-science", "wget", "mediapipe", "loguru", "typer_config", "fastapi", "rich", "google-generativeai", "diffusers", "omegaconf", "tqdm", "transformers", "kornia", "image-reward", "ultralytics", "blend_modes", "blind-watermark", "qrcode", "pyzbar", "transparent-background", "huggingface_hub", "accelerate", "bitsandbytes", "torchscale", "wandb", "hydra-core", "psd-tools", "inference-cli[yolo-world]", "inference-gpu[yolo-world]", "onnxruntime"]

Expand Down

0 comments on commit 42b3af6

Please sign in to comment.