交互式批量裁剪
Click, drag, and crop a hundred frames the same way
- images
- IMAGE
Most crop nodes in ComfyUI are boring and correct: type four numbers, get a crop. Interactive Batch Crop is the rare one that actually gives you a GUI - a little cropping window right on the node where you drag a box over your image, tweak it, and then apply that exact crop to every frame in a batch. It's how this pack preps batches of 360° renders, cropping the person out of dozens of frames without typing coordinates once.
The catch, and it's a real one, is that it's a two-run workflow. The node needs one execution to figure out what it's looking at, then you open the cropper, then you run again. Concretely:
- Set your image source - either a
path(a folder, or multiple files separated by|) or animagestensor input. The tensor wins if both are connected. - Run the workflow once. This builds a preview cache so the cropper knows your image count.
- Click the ✂ Open Cropper button on the node. A window pops with your first image; drag and resize the crop box (Shift+drag moves the image, Ctrl+drag pans the box and image together, wheel zooms, arrows page through frames, thumbnails jump around).
- Pick a fill color for areas the crop extends past the image, hit confirm - the crop parameters get saved into the node's hidden
crop_params. - Run the workflow again. Every frame gets cropped identically, out-of-bounds regions filled with your chosen color, output as
images.
What you set
path- folder or|-separated file list (alternative toimages).max_preview- how many images the preview shows (default 10; it auto-samples if you have more).images- optional tensor source.crop_params,node_id,target_sizeare hidden and managed by the frontend JS - you never touch them.
The cropper has genuinely nice touches: aspect-ratio presets (1:1, 4:3, 16:9), a lock button for the ratio, edge snapping, an ↕ swap for width/height, and a fill color picker. If your source folder has mixed resolutions it asks you to pick a uniform size first.
Install
Part of user2318/ComfyUI-CustomNodeKit. ComfyUI Manager: search "CustomNodeKit". Or:
cd ComfyUI/custom_nodes
git clone https://github.com/user2318/ComfyUI-CustomNodeKit.git
cd ComfyUI-CustomNodeKit
pip install -r requirements.txt
then restart. The GUI needs the pack's js/ folder to load, so don't install the Python side and skip the frontend - they ship together, and a manual install from a zip can leave the cropper button missing.
The gotcha
The two-run flow trips everyone once. You set your crop, hit Run, and nothing changed - because the node only applies the saved params after you've actually confirmed in the cropper, and if you never opened it, there are no params to apply. Also, in path mode, frames that don't match the reference size are skipped with a console warning rather than resized, so a mixed-size folder silently crops only the matching frames. And the crop is one box for the whole batch - it's "crop everyone the same way," not "crop each person individually." If your subjects move around between frames, this isn't the node for that; it's the node for a consistent region.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| crop_params | STRING | — | |
| node_id | STRING | — | |
| path | STRING | 图片文件夹路径或用 | 分隔的多个文件路径。Folder path or multiple file paths separated by |. | |
| target_size | STRING | — | |
| max_preview | INT | 101–500 | 前端预览中显示的最大图片数量。Maximum number of images shown in the frontend preview. |
| imagesopt | IMAGE | 直接传入图片张量作为裁剪源(与 path 二选一)。Image tensor input as the crop source (alternative to path). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |