Publish current ComfyUI O1Key code baseline

Replace the prior release tree with the current plugin, frontend, tests, and documentation. Document retired node IDs and the public Gitea update source.
This commit is contained in:
Jony
2026-09-24 19:56:48 +08:00
parent 3e337722ab
commit ba920f2b66
183 changed files with 49496 additions and 9934 deletions
+31 -1
View File
@@ -8,6 +8,7 @@ separator bands near the expected grid lines, then crops each cell.
from __future__ import annotations
import os
from dataclasses import dataclass
from typing import List, Sequence, Tuple
@@ -327,6 +328,30 @@ def _split_one(
return crops, info
_IMAGE_EXTS = (".png", ".jpg", ".jpeg", ".bmp", ".webp", ".tiff", ".tif", ".gif")
def _load_folder_images(folder: str) -> List[Image.Image]:
if not os.path.isdir(folder):
raise ValueError(f"合并图切割:图片路径不是有效的文件夹:{folder}")
names = sorted(
name for name in os.listdir(folder)
if name.lower().endswith(_IMAGE_EXTS)
)
images: List[Image.Image] = []
for name in names:
path = os.path.join(folder, name)
if not os.path.isfile(path):
continue
with Image.open(path) as opened:
images.append(opened.convert("RGB"))
if not images:
raise ValueError(f"合并图切割:文件夹中没有可读取的图片:{folder}")
return images
class O1keyGridSplitter:
"""Split AI-generated grid/contact-sheet images into individual cells."""
@@ -343,6 +368,7 @@ class O1keyGridSplitter:
"裁掉外边距": ("BOOLEAN", {"default": True}),
"最小分隔线px": ("INT", {"default": 2, "min": 0, "max": 64, "step": 1}),
"最大输出张数": ("INT", {"default": 16, "min": 1, "max": 144, "step": 1}),
"图片路径": ("STRING", {"default": "", "multiline": False}),
}
}
@@ -366,8 +392,12 @@ class O1keyGridSplitter:
裁掉外边距: bool = True,
最小分隔线px: int = 2,
最大输出张数: int = 16,
图片路径: str = "",
):
source_images = tensor_to_pil(图像)
if 图片路径 and 图片路径.strip():
source_images = _load_folder_images(图片路径.strip())
else:
source_images = tensor_to_pil(图像)
all_crops: List[Image.Image] = []
info_lines: List[str] = []