ComfyUI Node
Crop By Mask V5 (Batch)
CropByMask V5 - 批处理智能裁剪节点 批处理模式: - single_frame: 单帧模式,逐帧独立计算(兼容 V4) - batch_first_reuse: 批处理模式,首帧计算 crop_box,后续帧自动复用 Reserve 模式: - absolute: 绝对值模式,使用固定像素值 (top/bottom/left/right_reserve) - ratio: 比例模式,基于 mask 尺寸计算 reserve * 左右 reserve = mask宽度 × ratio,上下 reserve = mask高度 × ratio * reserve_max 限制最大扩展像素(防止过度扩展) * 推荐比例:0.3(紧凑), 0.5(标准), 0.8(宽松) 使用说明: 1. 直接接收视频批次输入(无需 ImageList 转换) 2. batch_first_reuse 模式下,自动处理首帧和后续帧 3. ratio 模式适合不同尺寸的 mask(如视频中人脸大小变化) 4. device 参数支持 CPU/GPU 选择
Crop By Mask V5 (Batch)
- image
- mask_image
- crop_box
- cropped_image
- cropped_mask
- crop_box
- box_preview
◄detect▾►
◄reserve_mode▾►
◄top_reserve20►
◄bottom_reserve20►
◄left_reserve20►
◄right_reserve20►
◄top_reserve_ratio0.5►
◄bottom_reserve_ratio0.5►
◄left_reserve_ratio0.5►
◄right_reserve_ratio0.5►
◄reserve_max100►
◄round_to_multiple▾►
◄batch_mode▾►
◄deviceCPU►
CategorySwwan/image
Inputs (17)
| Name | Type | Default | Description |
|---|---|---|---|
| detect | COMBO | 3 options: mask_area, min_bounding_rect, max_inscribed_rect | |
| reserve_mode | COMBO | 2 options: absolute, ratio | |
| top_reserve | INT | 20-9999–9999 | — |
| bottom_reserve | INT | 20-9999–9999 | — |
| left_reserve | INT | 20-9999–9999 | — |
| right_reserve | INT | 20-9999–9999 | — |
| top_reserve_ratio | FLOAT | 0.50–10 | — |
| bottom_reserve_ratio | FLOAT | 0.50–10 | — |
| left_reserve_ratio | FLOAT | 0.50–10 | — |
| right_reserve_ratio | FLOAT | 0.50–10 | — |
| reserve_max | INT | 1000–1024 | — |
| round_to_multiple | COMBO | 8 options: 8, 16, 32, 64, 128, 256, +2 | |
| batch_mode | COMBO | 2 options: single_frame, batch_first_reuse | |
| device | COMBO | CPU | 2 options: CPU, GPU |
| imageopt | IMAGE | — | |
| mask_imageopt | IMAGE | — | |
| crop_boxopt | BOX | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| cropped_image | IMAGE | — |
| cropped_mask | IMAGE | — |
| crop_box | BOX | — |
| box_preview | IMAGE | — |