diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dec5d22 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +**/__pycache__ +.env +.python-version +__pycache__ +temp.py +temp.* +*.mkv +test-env.sh +todo.md +**/**/*roadmap.md diff --git a/Examples/NodeAutoSampler.json b/Examples/NodeAutoSampler.json new file mode 100644 index 0000000..34389e2 --- /dev/null +++ b/Examples/NodeAutoSampler.json @@ -0,0 +1 @@ +{"last_node_id":168,"last_link_id":278,"nodes":[{"id":133,"type":"SetNode","pos":[1750,860],"size":[210,58],"flags":{"collapsed":true},"order":7,"mode":0,"inputs":[{"name":"STRING","label":"STRING","type":"STRING","link":276}],"outputs":[{"name":"STRING","label":"STRING","type":"STRING","links":[247]}],"title":"Set_IF_Sampler","properties":{"previousName":""},"widgets_values":["IF_Sampler"],"color":"#332922","bgcolor":"#593930"},{"id":151,"type":"easy string","pos":[980,530],"size":[315,58],"flags":{},"order":0,"mode":0,"inputs":[],"outputs":[{"name":"string","localized_name":"字符串","label":"string","type":"STRING","links":null}],"properties":{"cnr_id":"comfyui-easy-use","ver":"45d5c08bbb354bcc7427a7774140e5aa4a2989cb","Node name for S&R":"easy string"},"widgets_values":["Juggernaut-XL_juggXIByRundiffusion_XL.safetensors"]},{"id":156,"type":"easy showAnything","pos":[1940,920],"size":[260,88],"flags":{},"order":11,"mode":0,"inputs":[{"name":"anything","localized_name":"输入任何","label":"anything","type":"*","shape":7,"link":247}],"outputs":[{"name":"output","localized_name":"output","label":"output","type":"*","links":null}],"properties":{"cnr_id":"comfyui-easy-use","ver":"45d5c08bbb354bcc7427a7774140e5aa4a2989cb","Node name for S&R":"easy showAnything"},"widgets_values":["dpmpp_2m_sde"],"color":"#332922","bgcolor":"#593930"},{"id":155,"type":"easy showAnything","pos":[1940,790],"size":[260,88],"flags":{},"order":10,"mode":0,"inputs":[{"name":"anything","localized_name":"输入任何","label":"anything","type":"*","shape":7,"link":246}],"outputs":[{"name":"output","localized_name":"output","label":"output","type":"*","links":null}],"properties":{"cnr_id":"comfyui-easy-use","ver":"45d5c08bbb354bcc7427a7774140e5aa4a2989cb","Node name for S&R":"easy showAnything"},"widgets_values":["5.0"],"color":"#332922","bgcolor":"#593930"},{"id":152,"type":"easy string","pos":[980,630],"size":[315,58],"flags":{},"order":1,"mode":0,"inputs":[],"outputs":[{"name":"string","localized_name":"字符串","label":"string","type":"STRING","links":null}],"properties":{"cnr_id":"comfyui-easy-use","ver":"45d5c08bbb354bcc7427a7774140e5aa4a2989cb","Node name for S&R":"easy string"},"widgets_values":["DreamShaperXL_v21TurboDPMSDE_XL.safetensors"]},{"id":153,"type":"easy string","pos":[980,730],"size":[315,58],"flags":{},"order":2,"mode":0,"inputs":[],"outputs":[{"name":"string","localized_name":"字符串","label":"string","type":"STRING","links":null}],"properties":{"cnr_id":"comfyui-easy-use","ver":"45d5c08bbb354bcc7427a7774140e5aa4a2989cb","Node name for S&R":"easy string"},"widgets_values":["RealArchvis_V30_XL.safetensors"]},{"id":134,"type":"easy showAnything","pos":[1940,1050],"size":[260,88],"flags":{},"order":8,"mode":0,"inputs":[{"name":"anything","localized_name":"输入任何","label":"anything","type":"*","shape":7,"link":277}],"outputs":[{"name":"output","localized_name":"output","label":"output","type":"*","links":null}],"properties":{"cnr_id":"comfyui-easy-use","ver":"45d5c08bbb354bcc7427a7774140e5aa4a2989cb","Node name for S&R":"easy showAnything"},"widgets_values":["20;3.5;dpmpp_2m_sde"],"color":"#332922","bgcolor":"#593930"},{"id":132,"type":"SetNode","pos":[1750,780],"size":[210,58],"flags":{"collapsed":true},"order":6,"mode":0,"inputs":[{"name":"FLOAT","label":"FLOAT","type":"FLOAT","link":275}],"outputs":[{"name":"FLOAT","label":"FLOAT","type":"FLOAT","links":[246]}],"title":"Set_IF_Cfg","properties":{"previousName":""},"widgets_values":["IF_Cfg"],"color":"#232","bgcolor":"#353"},{"id":131,"type":"SetNode","pos":[1750,710],"size":[210,58],"flags":{"collapsed":true},"order":5,"mode":0,"inputs":[{"name":"INT","label":"INT","type":"INT","link":274}],"outputs":[{"name":"INT","label":"INT","type":"INT","links":[245]}],"title":"Set_IF_Steps","properties":{"previousName":""},"widgets_values":["IF_Steps"],"color":"#1b4669","bgcolor":"#29699c"},{"id":154,"type":"easy showAnything","pos":[1940,670],"size":[260,88],"flags":{},"order":9,"mode":0,"inputs":[{"name":"anything","localized_name":"输入任何","label":"anything","type":"*","shape":7,"link":245}],"outputs":[{"name":"output","localized_name":"output","label":"output","type":"*","links":null}],"properties":{"cnr_id":"comfyui-easy-use","ver":"45d5c08bbb354bcc7427a7774140e5aa4a2989cb","Node name for S&R":"easy showAnything"},"widgets_values":["30"],"color":"#332922","bgcolor":"#593930"},{"id":135,"type":"easy ckptNames","pos":[980,880],"size":[360,58],"flags":{},"order":3,"mode":0,"inputs":[],"outputs":[{"name":"ckpt_name","localized_name":"模型名称","label":"ckpt_name","type":"*","shape":3,"links":[278],"slot_index":0}],"properties":{"cnr_id":"comfyui-easy-use","ver":"45d5c08bbb354bcc7427a7774140e5aa4a2989cb","Node name for S&R":"easy ckptNames","hasSecondTab":false,"secondTabText":"Send Back","enableTabs":false,"secondTabOffset":80,"tabWidth":65,"secondTabWidth":65,"tabXOffset":10},"widgets_values":["SD_XL\\0_Juggernaut-XL_juggXIByRundiffusion_XL.safetensors"],"color":"#233","bgcolor":"#355"},{"id":168,"type":"NodeAutoSampler","pos":[1410,710],"size":[315,382],"flags":{},"order":4,"mode":0,"inputs":[{"name":"ckpt_name","type":"STRING","widget":{"name":"ckpt_name"},"link":278}],"outputs":[{"name":"steps","localized_name":"steps","label":"steps","type":"INT","links":[274],"slot_index":0},{"name":"cfg","localized_name":"cfg","label":"cfg","type":"FLOAT","links":[275],"slot_index":1},{"name":"sampler","localized_name":"sampler","label":"sampler","type":"STRING","links":[276],"slot_index":2},{"name":"text","localized_name":"text","label":"text","type":"STRING","links":[277],"slot_index":3}],"properties":{"Node name for S&R":"NodeAutoSampler"},"widgets_values":["","Auto","light,turbo",5,2,"dpmpp_sde",30,5,"dpmpp_2m_sde",20,3.5,"dpmpp_2m_sde"]}],"links":[[245,131,0,154,0,"*"],[246,132,0,155,0,"*"],[247,133,0,156,0,"*"],[274,168,0,131,0,"INT"],[275,168,1,132,0,"FLOAT"],[276,168,2,133,0,"STRING"],[277,168,3,134,0,"*"],[278,135,0,168,0,"STRING"]],"groups":[{"id":2,"title":"Other model /其他模型名称","bounding":[970,460,335,341.6000061035156],"color":"#3f789e","font_size":24,"flags":{}}],"config":{},"extra":{"ds":{"scale":0.7972024500000005,"offset":[-318.17963888740945,-419.88668580363947]},"node_versions":{"comfy-core":"v0.3.10-33-g7da85fa","python-interpreter-node":"ac2547ada25643be7cfe4b8030e57059c9da5bd7"},"VHS_latentpreview":false,"VHS_latentpreviewrate":0,"ue_links":[]},"version":0.4} \ No newline at end of file diff --git a/Examples/NodeAutoSampler.png b/Examples/NodeAutoSampler.png new file mode 100644 index 0000000..d202aab Binary files /dev/null and b/Examples/NodeAutoSampler.png differ diff --git a/Examples/NodeResizeImage_16ceil.json b/Examples/NodeResizeImage_16ceil.json new file mode 100644 index 0000000..397d7e8 --- /dev/null +++ b/Examples/NodeResizeImage_16ceil.json @@ -0,0 +1 @@ +{"last_node_id":126,"last_link_id":239,"nodes":[{"id":92,"type":"easy imageSize","pos":[1250,690],"size":[210,108],"flags":{},"order":3,"mode":0,"inputs":[{"name":"image","localized_name":"图像","label":"image","type":"IMAGE","link":224}],"outputs":[{"name":"width_int","localized_name":"宽度","label":"width_int","type":"INT","links":null},{"name":"height_int","localized_name":"高度","label":"height_int","type":"INT","links":null}],"properties":{"cnr_id":"comfyui-easy-use","ver":"45d5c08bbb354bcc7427a7774140e5aa4a2989cb","Node name for S&R":"easy imageSize"},"widgets_values":["Width: 768 , Height: 768"]},{"id":121,"type":"easy showAnything","pos":[1900,1260],"size":[210,88],"flags":{},"order":8,"mode":0,"inputs":[{"name":"anything","localized_name":"输入任何","label":"anything","type":"*","shape":7,"link":239}],"outputs":[{"name":"output","localized_name":"output","label":"output","type":"*","links":null}],"properties":{"cnr_id":"comfyui-easy-use","ver":"45d5c08bbb354bcc7427a7774140e5aa4a2989cb","Node name for S&R":"easy showAnything"},"widgets_values":["1024"]},{"id":114,"type":"easy showAnything","pos":[1900,1130],"size":[210,88],"flags":{},"order":7,"mode":0,"inputs":[{"name":"anything","localized_name":"输入任何","label":"anything","type":"*","shape":7,"link":238}],"outputs":[{"name":"output","localized_name":"output","label":"output","type":"*","links":null}],"properties":{"cnr_id":"comfyui-easy-use","ver":"45d5c08bbb354bcc7427a7774140e5aa4a2989cb","Node name for S&R":"easy showAnything"},"widgets_values":["1024"]},{"id":123,"type":"easy int","pos":[920,1210],"size":[315,58],"flags":{},"order":0,"mode":0,"inputs":[],"outputs":[{"name":"int","localized_name":"整数","label":"int","type":"INT","links":[]}],"properties":{"cnr_id":"comfyui-easy-use","ver":"45d5c08bbb354bcc7427a7774140e5aa4a2989cb","Node name for S&R":"easy int"},"widgets_values":[1024]},{"id":120,"type":"LoadImage","pos":[920,860],"size":[315,314],"flags":{},"order":1,"mode":0,"inputs":[],"outputs":[{"name":"IMAGE","localized_name":"图像","label":"IMAGE","type":"IMAGE","links":[224,234],"slot_index":0},{"name":"MASK","localized_name":"遮罩","label":"MASK","type":"MASK","links":null}],"properties":{"cnr_id":"comfy-core","ver":"0.3.26","Node name for S&R":"LoadImage"},"widgets_values":["example.png","image"]},{"id":125,"type":"NodeResizeImage","pos":[1470,860],"size":[315,98],"flags":{},"order":4,"mode":0,"inputs":[{"name":"image","localized_name":"image","label":"image","type":"IMAGE","link":234}],"outputs":[{"name":"image_resize","localized_name":"image_resize","label":"image_resize","type":"IMAGE","links":[236,237],"slot_index":0},{"name":"width","localized_name":"width","label":"width","type":"INT","links":[238],"slot_index":1},{"name":"height","localized_name":"height","label":"height","type":"INT","links":[239],"slot_index":2}],"properties":{"aux_id":"KERRY-YUAN/ComfyUI_Python_Executor","ver":"6edf61a4832e4f2fda73d39dd71241c3285ab8f5","Node name for S&R":"NodeResizeImage"},"widgets_values":[1024]},{"id":113,"type":"PreviewImage","pos":[1900,840],"size":[210,246],"flags":{},"order":5,"mode":0,"inputs":[{"name":"images","localized_name":"图像","label":"images","type":"IMAGE","link":236}],"outputs":[],"properties":{"cnr_id":"comfy-core","ver":"0.3.27","Node name for S&R":"PreviewImage"},"widgets_values":[]},{"id":122,"type":"easy imageSize","pos":[1900,690],"size":[210,108],"flags":{},"order":6,"mode":0,"inputs":[{"name":"image","localized_name":"图像","label":"image","type":"IMAGE","link":237}],"outputs":[{"name":"width_int","localized_name":"宽度","label":"width_int","type":"INT","links":null},{"name":"height_int","localized_name":"高度","label":"height_int","type":"INT","links":null}],"properties":{"cnr_id":"comfyui-easy-use","ver":"45d5c08bbb354bcc7427a7774140e5aa4a2989cb","Node name for S&R":"easy imageSize"},"widgets_values":["Width: 1024 , Height: 1024"]},{"id":126,"type":"Note","pos":[1470,1000],"size":[310,120],"flags":{},"order":2,"mode":0,"inputs":[],"outputs":[],"properties":{},"widgets_values":["## Resizes image tensor based on target short side, ensuring dimensions are multiples of 16 (ceil).\n## 根据目标短边调整图像张量大小,确保尺寸为16的倍数(向上取整)。"],"color":"#432","bgcolor":"#653"}],"links":[[224,120,0,92,0,"IMAGE"],[234,120,0,125,0,"IMAGE"],[236,125,0,113,0,"IMAGE"],[237,125,0,122,0,"IMAGE"],[238,125,1,114,0,"*"],[239,125,2,121,0,"*"]],"groups":[],"config":{},"extra":{"ds":{"scale":0.45,"offset":[410.55555555555543,-91.11111111111109]},"node_versions":{"comfy-core":"v0.3.10-33-g7da85fa","python-interpreter-node":"ac2547ada25643be7cfe4b8030e57059c9da5bd7"},"VHS_latentpreview":false,"VHS_latentpreviewrate":0,"ue_links":[]},"version":0.4} \ No newline at end of file diff --git a/Examples/NodeResizeImage_16ceil.png b/Examples/NodeResizeImage_16ceil.png new file mode 100644 index 0000000..738a26d Binary files /dev/null and b/Examples/NodeResizeImage_16ceil.png differ diff --git a/NodeSimpleExecutor.py b/NodeSimpleExecutor.py new file mode 100644 index 0000000..0136851 --- /dev/null +++ b/NodeSimpleExecutor.py @@ -0,0 +1,119 @@ +""" +Author: "KERRY-YUAN", +Title: "NodeSimpleExecutor", +Git-clone: "https://github.com/KERRY-YUAN/ComfyUI_Simple_Executor", +This node package contains automatic sampler setting according to model name in ComfyUI, adjusting image size according to specific constraints and some other nodes. +本节点包包含在 ComfyUI 中根据模型名称自动处理采样器设置、按特定约束调整图像大小和一些其他节点。。 +""" + +import torch +import math +import numpy as np +from PIL import Image +from comfy.samplers import KSampler + +#--------------------------------------------------------------------------------------------------------------# +#Based on the input model name, automatically match the configuration parameters of step count, CFG value, and sampler name through "Auto, Light, Normal, User". +#根据输入的模型名称,通过“Auto、If_include、Else、User”自动化匹配步数、CFG值和采样器名称的配置参数。 + +class NodeAutoSampler: + @classmethod + def INPUT_TYPES(s): + # 获取 ComfyUI 中的采样器名称列表 + sampler_names = KSampler.SAMPLERS + return { + "required": { + "ckpt_name": ("STRING", {"default": ""}), + "mode": (["Auto", "If_include", "Else", "User"], {"default": "Auto"}) + }, + "optional": { + "if_include": ("STRING", {"default": "light,turbo"}), + "if_steps": ("INT", {"default": 5, "min": 1, "max": 1000}), + "if_cfg": ("FLOAT", {"default": 2.0, "min": 0.1, "max": 100.0}), + "if_sampler": (sampler_names, {"default": "dpmpp_sde"}), + "else_steps": ("INT", {"default": 30, "min": 1, "max": 1000}), + "else_cfg": ("FLOAT", {"default": 5.0, "min": 0.1, "max": 100.0}), + "else_sampler": (sampler_names, {"default": "dpmpp_2m_sde"}), + "user_steps": ("INT", {"default": 20, "min": 1, "max": 1000}), + "user_cfg": ("FLOAT", {"default": 3.5, "min": 0.1, "max": 100.0}), + "user_sampler": (sampler_names, {"default": "dpmpp_2m_sde"}) + } + } + + RETURN_TYPES = ("INT", "FLOAT", "STRING", "STRING") + RETURN_NAMES = ("steps", "cfg", "sampler", "text") + FUNCTION = "generate_dynamic_settings" + CATEGORY = "custom" + + def generate_dynamic_settings(self, ckpt_name, mode, **kwargs): + mode_priority = { + "If_include": "1", "Else": "2", "User": "3", "Auto": "0" + } + selected_mode = mode_priority[mode] + + if selected_mode == "0": + input_str = str(ckpt_name).lower() + keywords = [k.strip().lower() for k in kwargs.get("if_include", "").split(',')] + selected_mode = "1" if any(k in input_str for k in keywords) else \ + "3" if "userconfig" in input_str else "2" + + config_map = { + "1": (kwargs["if_steps"], kwargs["if_cfg"], kwargs["if_sampler"]), + "2": (kwargs["else_steps"], kwargs["else_cfg"], kwargs["else_sampler"]), + "3": (kwargs["user_steps"], kwargs["user_cfg"], kwargs["user_sampler"]) + } + steps, cfg, sampler = config_map.get(selected_mode, (30, 5.0, "dpmpp_2m_sde")) + + return (steps, cfg, sampler, f"{steps};{cfg};{sampler}") + +#---------------------------------------------------------------------------------------------------------------------------------------------------# +#Resizes the image based on the target short side (`num`), maintaining aspect ratio, with final width and height both rounded up (ceil) to the nearest multiple of 16. +#根据目标短边 (`num`) 调整图像大小,保持宽高比,最终宽高均向上取整为 16 的倍数。 + +class NodeResizeImage: + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "image": ("IMAGE",), + "shortside": ("INT", {"default": 1024, "min": 560, "max": 9600, "step": 16}), + } + } + RETURN_TYPES = ("IMAGE", "INT", "INT") + RETURN_NAMES = ("image_resize", "width", "height") + FUNCTION = "resize_image" + CATEGORY = "Image/Transform" + + def _tensor_to_pil(self, img_tensor): + # Convert tensor to PIL Image / 将张量转换为 PIL 图像。 + img_np = img_tensor[0].cpu().numpy() * 255.0 + img_np = np.clip(img_np, 0, 255).astype(np.uint8)[:, :, :3] + return Image.fromarray(img_np, 'RGB') + + def _pil_to_tensor(self, img_pil): + # Convert PIL Image to tensor / 将 PIL 图像转换为张量。 + img_np = np.array(img_pil).astype(np.float32) / 255.0 + return torch.from_numpy(img_np).unsqueeze(0) + + def _calculate_dimensions(self, w, h, target): + target = ((min(max(target, 560), 9600) + 15) // 16) * 16 + scale = target / min(w, h) + new_w = round(w * scale) if w < h else ((round(w * scale) + 15) // 16) * 16 + new_h = ((round(h * scale) + 15) // 16) * 16 if w < h else target + return new_w, new_h + + def resize_image(self, image, shortside): + img_pil = self._tensor_to_pil(image) + original_w, original_h = img_pil.size + final_w, final_h = self._calculate_dimensions(original_w, original_h, shortside) + if (original_w, original_h) != (final_w, final_h): + img_pil = img_pil.resize((final_w, final_h), Image.Resampling.LANCZOS) + return (self._pil_to_tensor(img_pil), final_w, final_h) + +#---------------------------------------------------------------------------------------------------------------------------------------------------# +#Node Registration / 节点注册 + +NODE_CLASS_MAPPINGS = { + "NodeResizeImage": NodeResizeImage, + "NodeAutoSampler": NodeAutoSampler, +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..6b8f179 --- /dev/null +++ b/README.md @@ -0,0 +1,90 @@ +# ComfyUI_Simple_Executor +This node package includes nodes for automatically processing sampler settings based on model names and resizing images with specific constraints within ComfyUI. Subject to occasional updates. +本节点包包含在 ComfyUI 中根据模型名称自动处理采样器设置、按特定约束调整图像大小和一些其他节点。不定时更新中。 + +## Node List + +* **NodeAutoSampler**: Automatically sets sampler settings. +* **NodeResizeImage**: Resizes images, rounding dimensions up to multiples of 16. + +## Node Descriptions + +### 1. NodeAutoSampler (`NodeAutoSampler`) + +* **Description**: Sets sampler steps, CFG, and name based on the input `ckpt_name` and selected `mode` ("Auto", "If_include", "Else", "User"). Uses conditional logic based on keywords in `ckpt_name` or predefined settings. +* **Category**: `custom` +* **Key Inputs**: + * `ckpt_name` (STRING): Checkpoint name for logic. + * `mode` (COMBO): Operation mode. + * Optional settings for `if`, `else`, `user` conditions (steps, cfg, sampler). +* **Outputs**: `steps` (INT), `cfg` (FLOAT), `sampler` (STRING), `text` (STRING summary). +* **Usage**: Use 'Auto' mode with `if_include`='light' to apply specific settings (e.g., low steps/cfg) when 'light' is in the model name. +![image](https://github.com/KERRY-YUAN/ComfyUI_Simple_Executor/blob/main/Examples/NodeAutoSampler.png) + +--- +### 2. NodeResizeImage (`NodeResizeImage`) + +* **Description**: Resizes an image based on a target `shortside` length, maintaining aspect ratio. Final width and height are both rounded *up* (ceil) to the nearest multiple of 16. +* **Category**: `Image/Transform` +* **Inputs**: + * `image` (IMAGE): Image to resize. + * `shortside` (INT): Target length for the shorter side. +* **Outputs**: + * `image_resize` (IMAGE): Resized image. + * `width` (INT): Final width (multiple of 16). + * `height` (INT): Final height (multiple of 16). +* **Usage**: Resize 800x600 with `shortside`=768 results in 1024x768 output dimensions, as both are rounded up to the nearest 16x multiple. +![image](https://github.com/KERRY-YUAN/ComfyUI_Simple_Executor/blob/main/Examples/NodeResizeImage_16ceil.png) + +--- + +## Installation Steps + +1. Clone the repository into ComfyUI's `custom_nodes` directory: + cd /path/to/comfyui/custom_nodes + git clone https://github.com/KERRY-YUAN/ComfyUI_Simple_Executor.git +2. Restart ComfyUI. + +--- +--- + +## 节点列表 + +* **NodeAutoSampler**: 自动设置采样器参数。 +* **NodeResizeImage**: 调整图像大小,并将尺寸向上取整至16的倍数。 + +## 节点说明 + +### 1. NodeAutoSampler (`NodeAutoSampler`) + +* **描述**: 根据输入的 `ckpt_name` 和选择的 `mode`("Auto", "If_include", "Else", "User")设置采样器步数、CFG 和名称。基于 `ckpt_name` 中的关键字或预定义设置使用条件逻辑。 +* **分类**: `custom` +* **主要输入**: + * `ckpt_name` (STRING): 用于逻辑判断的检查点名称。 + * `mode` (下拉框): 操作模式。 + * 用于 `if`, `else`, `user` 条件的可选设置 (步数, cfg, 采样器)。 +* **输出**: `steps` (INT), `cfg` (FLOAT), `sampler` (STRING), `text` (STRING 摘要)。 +* **使用**: 使用 'Auto' 模式配合 `if_include`='light',可在模型名称含 'light' 时应用特定设置(如低步数/CFG)。 + +--- +### 2. NodeResizeImage (`NodeResizeImage`) + +* **描述**: 根据目标 `shortside` 长度调整图像大小,保持宽高比。最终宽度和高度都将向上(ceil)取整至最接近的 16 的倍数。 +* **分类**: `Image/Transform` +* **输入**: + * `image` (IMAGE): 待调整图像。 + * `shortside` (INT): 目标短边长度。 +* **输出**: + * `image_resize` (IMAGE): 调整后的图像。 + * `width` (INT): 最终宽度(16的倍数)。 + * `height` (INT): 最终高度(16的倍数)。 +* **使用**: 使用 `shortside`=768 调整 800x600 图像,输出尺寸为 1024x768,因为宽高都向上取整至最接近的16倍数。 + +--- + +## 安装步骤 + +1. 将仓库克隆到 ComfyUI 的 `custom_nodes` 目录: + cd /path/to/comfyui/custom_nodes + git clone https://github.com/KERRY-YUAN/ComfyUI_Simple_Executor.git +2. 重启 ComfyUI。 \ No newline at end of file diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..1232de7 --- /dev/null +++ b/__init__.py @@ -0,0 +1,11 @@ +""" +Author: "KERRY-YUAN", +Title: "NodeSimpleExecutor", +Git-clone: "https://github.com/KERRY-YUAN/ComfyUI_Simple_Executor", +This node package contains automatic sampler setting according to model name in ComfyUI, adjusting image size according to specific constraints and some other nodes. +本节点包包含在 ComfyUI 中根据模型名称自动处理采样器设置、按特定约束调整图像大小和一些其他节点。。 +""" + +from .NodeSimpleExecutor import NODE_CLASS_MAPPINGS + +__all__ = ['NODE_CLASS_MAPPINGS'] \ No newline at end of file diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..13d5fe2 --- /dev/null +++ b/manifest.json @@ -0,0 +1,11 @@ + { + "author": "KERRY-YUAN", + "title": "NodeSimpleExecutor", + "id": "NodeSimpleExecutor", + "reference": "https://github.com/KERRY-YUAN/ComfyUI_Simple_Executor", + "files": [ + "https://github.com/KERRY-YUAN/ComfyUI_Simple_Executor" + ], + "install_type": "git-clone", + "description": "This node package contains automatic sampler setting according to model name in ComfyUI, adjusting image size according to specific constraints and some other nodes." + }, \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..35e492c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +torch>=1.12.0 +numpy>=1.21.0 +Pillow>=8.0.0 \ No newline at end of file