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).
27 lines
1.2 KiB
Python
27 lines
1.2 KiB
Python
"""Node: ImgUtilsAlign — Resize image to max dimension."""
|
|
from __future__ import annotations
|
|
from comfy_api.latest import io
|
|
from ..utils import comfy_to_pil, pil_to_comfy
|
|
|
|
class ImgUtilsAlign(io.ComfyNode):
|
|
@classmethod
|
|
def define_schema(cls) -> io.Schema:
|
|
return io.Schema(
|
|
node_id="ImgUtilsAlign", display_name="Imgutils Align",
|
|
category="imgutils/transform",
|
|
description="Resize image so its longest side matches max_size, preserving aspect ratio.",
|
|
search_aliases=["align", "resize", "max", "fit", "scale"],
|
|
inputs=[
|
|
io.Image.Input("image", tooltip="Input image"),
|
|
io.Int.Input("max_size", default=1024, min=64, max=8192, step=64, tooltip="Maximum side length."),
|
|
],
|
|
outputs=[io.Image.Output(display_name="image")],
|
|
)
|
|
|
|
@classmethod
|
|
def execute(cls, image, max_size) -> io.NodeOutput:
|
|
from imgutils.operate import align_maxsize
|
|
pil = comfy_to_pil(image.numpy() if hasattr(image, "numpy") else image)
|
|
result = align_maxsize(pil, max_size=int(max_size))
|
|
return io.NodeOutput(pil_to_comfy(result))
|