Image_Pair_crop
Pull the second image's region back out after Image_Pair_Merge
- image
- mask
- box2
- 裁剪图像
- 裁剪遮罩
The other half of Image_Pair_Merge. Once a merged composite has been through whatever generation or edit step you ran it through as a shared canvas, Image_Pair_crop uses the box2 token from that merge to find image2's original region again and crop it back out.
How it works
box2 (required) is the bounding-box token Image_Pair_Merge produced when it built the composite - it encodes exactly where image2 landed. image and mask are whatever you're cropping (typically the processed composite, or its mask), and crop_image is a boolean that decides whether the node actually performs the crop or just passes through. This is the same underlying idea as the crop-and-stitch pattern elsewhere in this pack (Image_pad_adjust/restore, Image_mask_crop_visual): put two things through one process together, then use a saved geometry token to mechanically pull one part back out afterward.
The inputs and outputs that matter
image,mask(both required) - what you're cropping.box2(required) - must come from a matchingImage_Pair_Mergecall.crop_image(default false) - actually toggles whether cropping happens.- Output: the schema's own names translate to "cropped image" and "cropped mask" - the region of the processed image corresponding to where image2 originally sat in the composite.
How to install it
Via ComfyUI Manager: search ComfyUI-Apt_Preset, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git
Windows: install.bat. Linux/Mac: pip install -r ComfyUI-Apt_Preset/requirements.txt in your venv. Restart. Nothing to download for this node - the pack's heavier dependencies belong to other parts of this ~300-star, actively maintained pack.
Common issues & troubleshooting
Getting the whole image back instead of just image2's region. crop_image defaults to false - if you wire this node up and the output looks like the full composite rather than a crop, that's the first thing to check.
Result doesn't line up with where image2 actually was. Like Image_pad_adjust_restore, this node only works correctly with a box2 that came from the matching Image_Pair_Merge call earlier in the graph. A box2 from a different merge, or a composite that's been resized in between, won't line up - the geometry it encodes is specific to that one merge operation.
Lost the box2 connection somewhere upstream. Without it, this node has nothing to crop against. Trace the wire back to Image_Pair_Merge if the crop output looks wrong or empty.
Why bother with the pair instead of just cropping manually. The whole point of carrying box2 through your generation step is that you don't have to remember or recompute coordinates by hand after whatever processing happened to the composite - resizing, a sampler pass, another node in between. As long as box2 stays connected, Image_Pair_crop finds the right region regardless of what else touched the image on the way, the same guarantee crop-and-stitch pairs give you elsewhere in image editing.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mask | MASK | — | |
| box2 | BOX2 | — | |
| crop_image | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| 裁剪图像 | IMAGE | — |
| 裁剪遮罩 | MASK | — |