Crops images based on mask detection and resizes to target resolution with multiple methods.
This node processes batches of images and masks, ensuring all outputs have
consistent dimensions. It uses a three-stage approach:
1. **Analysis Stage**: Detect crop regions for each mask individually
2. **Unification Stage**: Calculate optimal unified dimensions
3. **Processing Stage**: Crop all images with unified dimensions and resize
Resize Methods:
- **fill**: Scale to completely fill target size (may crop edges)
- **crop**: Scale to fit within target size, center and pad with black
- **letterbox**: Scale to fit within target size, add black bars to maintain aspect ratio
- **stretch**: Directly stretch to target size (may distort aspect ratio)
Features:
- **Batch Processing**: Handles multiple images and masks correctly
- **16-pixel Alignment**: Ensures dimensions are divisible by 16 (AI-friendly)
- **Multiple Resize Methods**: Choose the best method for your use case
- **Quality Upscaling**: Support for nearest, bilinear, bicubic, and Lanczos
- **Flexible Constraints**: Min/max crop resolution limits
Parameters:
- **base_resolution**: Target resolution for the longer side
- **padding**: Extra padding around detected regions
- **min/max_crop_resolution**: Constraints for crop region size
- **resize_method**: How to handle aspect ratio when resizing
- **upscale_method**: Interpolation method for high-quality scaling
By whmc76·Created about a year ago·Updated 24 days ago· 70