Files

46 lines
1.5 KiB
Python

"""
rotate-image — ComfyUI Custom Nodes
====================================
Provides two paired nodes for angle-based image rotation in ComfyUI pipelines:
• RotateImage — rotate by any angle, expand canvas, fill with black
• RestoreRotatedImage — reverse the rotation and crop to original dimensions
Typical workflow
----------------
[Image] → RotateImage → [processing nodes] → RestoreRotatedImage → [Result]
The RotateImage node emits a ROTATION_INFO value that must be wired into
RestoreRotatedImage so it can perform the exact inverse transformation.
"""
import sys
from pathlib import Path
# Ensure this custom-node directory is on sys.path so that the sub-packages
# 'ri_nodes' and 'ri_utils' are importable regardless of ComfyUI's cwd.
# We use the prefix 'ri_' to avoid colliding with ComfyUI's own 'nodes.py'.
_HERE = Path(__file__).parent.resolve()
if str(_HERE) not in sys.path:
sys.path.insert(0, str(_HERE))
from ri_nodes.rotate_image import RotateImage # noqa: E402
from ri_nodes.restore_rotated import RestoreRotatedImage # noqa: E402
# ---------------------------------------------------------------------------
# ComfyUI node registration
# ---------------------------------------------------------------------------
NODE_CLASS_MAPPINGS = {
"RotateImage": RotateImage,
"RestoreRotatedImage": RestoreRotatedImage,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"RotateImage": "Rotate Image",
"RestoreRotatedImage": "Restore Rotated Image",
}
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"]