Files
L33chKing-ComfyUI_Channel_Ops/__init__.py
T
l33chKing 89e7920119 Add Color Matching node; Laplacian Sharpen & Unsharp Masking effects
- New ColorMatchingNode: two image inputs, one output, LAB/RGB/Histogram
  methods (LAB default). Live in-node preview recomputes in JS on method
  switch, mirroring the Layer Blending preview pattern.
- Filter Ops: add "Laplacian Sharpen" (4-/8-neighbor kernel) and
  "Unsharp Masking" (Gaussian amount/radius/threshold) effects, with
  matching JS live-preview implementations, widget visibility, tooltips.
- Update README (now four nodes) and node registration.
2026-07-03 11:59:29 +03:00

50 lines
1.6 KiB
Python

import os
from typing import Dict, Any
from .channel_ops import ChannelOpsNode
from .layer_blending import LayerBlendingNode
from .image_effects import ImageEffectsNode
from .color_matching import ColorMatchingNode
# Expose web extension directory so ComfyUI serves JS files from ./web
WEB_DIRECTORY = "./web"
NODE_CLASS_MAPPINGS: Dict[str, Any] = {
"ChannelOpsNode": ChannelOpsNode,
"LayerBlendingNode": LayerBlendingNode,
"ImageEffectsNode": ImageEffectsNode,
"ColorMatchingNode": ColorMatchingNode,
}
NODE_DISPLAY_NAME_MAPPINGS: Dict[str, str] = {
"ChannelOpsNode": "Channel Ops (live-preview)",
"LayerBlendingNode": "Layer Blending (live-preview)",
"ImageEffectsNode": "Filter Ops (live-preview)",
"ColorMatchingNode": "Color Matching (live-preview)",
}
__all__ = [
"NODE_CLASS_MAPPINGS",
"NODE_DISPLAY_NAME_MAPPINGS",
"WEB_DIRECTORY",
]
# Cleanup: remove all preview images in our web folder at startup
def _cleanup_web_folder():
try:
this_dir = os.path.dirname(os.path.abspath(__file__))
web_dir = os.path.join(this_dir, "web")
if not os.path.isdir(web_dir):
return
for name in os.listdir(web_dir):
# Only delete image files to avoid removing JS or other assets
if name.lower().endswith((".png", ".jpg", ".jpeg")):
try:
os.remove(os.path.join(web_dir, name))
except Exception:
pass
except Exception:
# Silent by design; preview cleanup is best-effort
pass
_cleanup_web_folder()