Sub-packages: - edge/ — Canny, Lineart, LineartAnime (3 nodes) - restore/ — SCUNet, NAFNet, Adversarial (3 nodes) - compare/ — CCIP, LPIPS (2 nodes) - validate/ — Classify (11 ops), Check (5 ops), Metric (2 ops) - tagging/ — WD14, DeepDanbooru, DeepGelbooru, MLDanbooru, Camie, PixAI (6 nodes) Root nodes: - ImgUtilsOCR — PaddleOCR with heat/box threshold - ImgUtilsDetect — 10 detection types + confidence knob - ImgUtilsPose — DWPose + auto_detect toggle - ImgUtilsSegment — isnetis + scale knob - ImgUtilsTags — tag string processing - ImgUtilsCDC — upscaling + tile_size - ImgUtilsCensor — NSFW censoring with method/confidence/body-part toggles - ImgUtilsAlign — resize to max dimension - ImgUtilsSqueeze — transparency-based auto-crop Every node exposes its native function parameters as knobs. Removed mega-nodes: transform (11 ops), compare (3 ops), validate (18 ops).
28 lines
1.3 KiB
Python
28 lines
1.3 KiB
Python
"""Node: ImgUtilsCanny — Canny edge detection."""
|
|
from __future__ import annotations
|
|
from comfy_api.latest import io
|
|
from ..utils import comfy_to_pil, pil_to_comfy
|
|
|
|
class ImgUtilsCanny(io.ComfyNode):
|
|
@classmethod
|
|
def define_schema(cls) -> io.Schema:
|
|
return io.Schema(
|
|
node_id="ImgUtilsCanny", display_name="Imgutils Edge (Canny)",
|
|
category="imgutils/edge",
|
|
description="Extract edges using Canny edge detection. Fastest edge method.",
|
|
search_aliases=["edge", "canny", "outline", "line", "sketch"],
|
|
inputs=[
|
|
io.Image.Input("image", tooltip="Input image"),
|
|
io.Int.Input("low_threshold", default=100, min=0, max=500, step=10, tooltip="Canny low threshold."),
|
|
io.Int.Input("high_threshold", default=200, min=0, max=500, step=10, tooltip="Canny high threshold."),
|
|
],
|
|
outputs=[io.Image.Output(display_name="image")],
|
|
)
|
|
|
|
@classmethod
|
|
def execute(cls, image, low_threshold, high_threshold) -> io.NodeOutput:
|
|
from imgutils.edge import edge_image_with_canny
|
|
pil = comfy_to_pil(image.numpy() if hasattr(image, "numpy") else image)
|
|
result = edge_image_with_canny(pil, low_threshold=int(low_threshold), high_threshold=int(high_threshold))
|
|
return io.NodeOutput(pil_to_comfy(result))
|