Nodes/ComfyUI_Swwan/Crop By Mask V5 (Batch)
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 选择

By aining2022·Created 9 months ago·Updated about a month ago· 27
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)

NameTypeDefaultDescription
detectCOMBO3 options: mask_area, min_bounding_rect, max_inscribed_rect
reserve_modeCOMBO2 options: absolute, ratio
top_reserveINT20-9999–9999
bottom_reserveINT20-9999–9999
left_reserveINT20-9999–9999
right_reserveINT20-9999–9999
top_reserve_ratioFLOAT0.50–10
bottom_reserve_ratioFLOAT0.50–10
left_reserve_ratioFLOAT0.50–10
right_reserve_ratioFLOAT0.50–10
reserve_maxINT1000–1024
round_to_multipleCOMBO8 options: 8, 16, 32, 64, 128, 256, +2
batch_modeCOMBO2 options: single_frame, batch_first_reuse
deviceCOMBOCPU2 options: CPU, GPU
imageoptIMAGE
mask_imageoptIMAGE
crop_boxoptBOX

Outputs (4)

NameTypeDescription
cropped_imageIMAGE
cropped_maskIMAGE
crop_boxBOX
box_previewIMAGE