This commit establishes the complete foundation for ComfyUI_Detonate: ## Project Structure - Created organized directory structure for all node categories - Set up proper Python package structure with __init__.py files ## Package Configuration - Added pyproject.toml with project metadata and dependencies - Created requirements.txt for core dependencies - Added requirements-dev.txt for development tools ## Documentation - Created comprehensive NODE_SPECIFICATIONS.md documenting all Priority 1 nodes - Includes exact formulas, parameters, and behaviors from Nuke/Fusion - Documents: Merge, Transform, Blur, Grade, Premult/Unpremult, Shuffle, ColorCorrect, Erode/Dilate - All specifications backed by official Nuke and Fusion documentation ## Core Utilities - tensor_utils.py: Tensor validation, alpha channel handling, resizing - image_processing.py: Premultiply/unpremultiply, luminance, masking, blending - color_math.py: RGB/HSV conversion, saturation, contrast, gamma, lift/gain/offset ## Node Registration - Created __init__.py with ComfyUI node registration system - Ready to register nodes as they are implemented All utility modules are fully documented with docstrings and type hints. Ready to begin Priority 1 node implementation.
84 lines
1.6 KiB
Python
84 lines
1.6 KiB
Python
"""
|
|
ComfyUI_Detonate Utilities Package
|
|
|
|
Provides common utilities for tensor operations, image processing,
|
|
and color mathematics used by all nodes.
|
|
"""
|
|
|
|
from .tensor_utils import (
|
|
validate_image_tensor,
|
|
ensure_alpha_channel,
|
|
remove_alpha_channel,
|
|
get_alpha_channel,
|
|
set_alpha_channel,
|
|
clamp_tensor,
|
|
resize_tensors_to_match,
|
|
resize_tensor,
|
|
batch_size,
|
|
image_dimensions,
|
|
channel_count,
|
|
copy_to_device,
|
|
)
|
|
|
|
from .image_processing import (
|
|
premultiply_alpha,
|
|
unpremultiply_alpha,
|
|
calculate_luminance,
|
|
normalize_range,
|
|
invert_image,
|
|
blend_images,
|
|
apply_mask,
|
|
extract_channel,
|
|
create_constant_image,
|
|
)
|
|
|
|
from .color_math import (
|
|
rgb_to_hsv,
|
|
hsv_to_rgb,
|
|
adjust_saturation,
|
|
adjust_contrast,
|
|
apply_gamma,
|
|
apply_gain,
|
|
apply_offset,
|
|
apply_lift,
|
|
lerp,
|
|
clamp_color,
|
|
)
|
|
|
|
__all__ = [
|
|
# tensor_utils
|
|
"validate_image_tensor",
|
|
"ensure_alpha_channel",
|
|
"remove_alpha_channel",
|
|
"get_alpha_channel",
|
|
"set_alpha_channel",
|
|
"clamp_tensor",
|
|
"resize_tensors_to_match",
|
|
"resize_tensor",
|
|
"batch_size",
|
|
"image_dimensions",
|
|
"channel_count",
|
|
"copy_to_device",
|
|
# image_processing
|
|
"premultiply_alpha",
|
|
"unpremultiply_alpha",
|
|
"calculate_luminance",
|
|
"normalize_range",
|
|
"invert_image",
|
|
"blend_images",
|
|
"apply_mask",
|
|
"extract_channel",
|
|
"create_constant_image",
|
|
# color_math
|
|
"rgb_to_hsv",
|
|
"hsv_to_rgb",
|
|
"adjust_saturation",
|
|
"adjust_contrast",
|
|
"apply_gamma",
|
|
"apply_gain",
|
|
"apply_offset",
|
|
"apply_lift",
|
|
"lerp",
|
|
"clamp_color",
|
|
]
|