Crop Batch Image Location
Batch-crop images to a rectangle, or drive it from a detected mask region
- images
- crop_data_batch
- images
- crop_data_batch
On its own, Crop Batch Image Location is nothing special - feed it an image batch and four coordinates, get back every image in the batch cropped to that rectangle. The interesting part is the optional crop_data_batch input: that's the exact type SaltMaskCropRegion, elsewhere in this same pack, outputs after it finds where a mask's dominant region actually sits. Wire the two together and you've replaced typing four fixed pixel numbers with a crop that follows wherever your subject actually is, per image, across a whole batch.
How it works
This is the crop half of a detection → crop → process → paste-back pipeline - the same shape anyone who's used Impact Pack's FaceDetailer will recognize, just built from Salt's own primitives instead of Impact Pack's. Without crop_data_batch wired in, it's a plain manual crop using the four numbers you give it. With it wired in, that computed data effectively drives the crop instead, so you can find a region programmatically (via a mask, via detection, whatever produced the CROP_DATA_BATCH) and crop the matching image to exactly that spot without hand-tuning coordinates per image.
The inputs and outputs that matter
images(required, IMAGE) - your batch.top,left,right,bottom(all INT, defaults 0/0/256/256) - plain pixel coordinates, not width/height.rightandbottommean the coordinate of the far edge, not "how many pixels wide/tall," which trips people up coming from crop tools that use width/height instead.crop_data_batch(optional, CROP_DATA_BATCH) - feed this fromSaltMaskCropRegionto drive the crop from a detected region instead of fixed numbers.
Outputs: images (the cropped batch) and its own crop_data_batch, so the crop coordinates travel forward with the data rather than getting lost - useful if you need to paste results back at the original location later in the graph.
How to install it
ComfyUI Manager: search SaltAI-Open-Resources or SaltAI, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/get-salt-AI/SaltAI
then restart. No model, no heavy dependency - plain image cropping.
Common issues & troubleshooting
Crop errors or an empty image. Make sure top < bottom and left < right - an easy mistake to make once you're computing these numbers from an upstream node instead of typing them by hand, since nothing stops you from accidentally reversing an edge.
Manual numbers don't seem to matter anymore. That's expected once crop_data_batch is wired in - treat top/left/right/bottom as the fallback for when you're not feeding computed crop data, not as always-active values that combine with it.
Downstream node expects a fixed crop size, but yours varies. If crop_data_batch comes from a mask-driven node, crop sizes will differ per image based on subject size. Anything downstream assuming a uniform crop size across the batch will choke on that - resize after cropping if you need a consistent shape.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| top | INT | 00–10000000 | — |
| left | INT | 00–10000000 | — |
| right | INT | 2560–10000000 | — |
| bottom | INT | 2560–10000000 | — |
| crop_data_batchopt | CROP_DATA_BATCH | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| crop_data_batch | CROP_DATA_BATCH | — |