Custom node for ComfyUI for interactive region selection (boxes) with advanced features and critical bug fixes.
This is an optimized fork of the original BoxBox with several fixes and new functionalities:
-
Image Loading (ComfyUI v0.12.2+)
- Updated URL construction to use the ComfyUI API helper.
- Proper encoding for filenames with special characters.
- Error handling with fallback mechanisms.
-
Backend Stability
- Uses the standard ComfyUI
tempfolder. - Fixed HTTP responses using
web.json_response. - Filename sanitization to avoid path conflicts.
- Uses the standard ComfyUI
-
Precise Coordinate Scaling
- Fixed duplicate scaling (previously occurring in both frontend and backend).
- Exact conversion from display space coordinates to original image size.
-
Intermediate Node Support
- Recursive node chain traversal to find the source image.
- Compatible with processing nodes (Brightness, Blur, etc.) between
LoadImageandBoxSelector.
-
NumPy 2.0 Compatibility
- Updated server logic with explicit casting (
np.uint8,np.float32). - Resolved binary incompatibilities in coordinate processing.
- Updated server logic with explicit casting (
-
Adaptive Window Scaling
- Fixed coordinate misalignment when resizing the browser window.
- Dynamic calculation of the total scale factor (Server Scale * Browser CSS Scale).
-
Aspect Ratio Memory
- Remembers your last selected proportion via
localStorage. - Keeps the ratio locked when drawing new selections.
- Remembers your last selected proportion via
-
Selection Restoration
- Automatically restores the last selection when reopening the selector.
- Allows for quick adjustments to existing selections.
-
Improved UX
- Removed intrusive alerts for small images.
- Detailed console logging for debugging (
[BoxBox]).
- Add a LoadImage node.
- Add a BoxSelector node and connect them.
- Click the 📦 Select Box button.
- Draw the region in the popup window.
- Select an Aspect Ratio if desired and click ✅ Confirm.
- Use BoxCrop to get the image crop.
- 📦 BoxSelector: Interactive selection with ratio locking.
- ✂️ BoxCrop: Crops the image based on selected coordinates.
- 📐 BoxResize: Scales the crop while maintaining fidelity.
Documentation synchronized following the node-doc-sync protocol.