bbox restore mask
Put an Impact Pack cropped mask back where it belongs
- reference_image
- mask
- crop_region
- mask
This one only makes sense once you know the pattern it's plugging into: Impact Pack's whole reason for existing is detect → crop → refine → paste back. A detector finds a face or a hand, crops just that region out of the full image, a fresh sampling pass runs on the crop at proper resolution, and the result gets composited back into the original frame. bbox_restore_mask handles the mask side of that "paste back" step - specifically the "SEG editing" case, where you've modified a mask that lives in cropped coordinates and need it placed correctly back onto the full-size canvas.
WJNodes says it plainly in the node's own description: this is Impact Pack's crop_region restore logic, lifted out as its own node. You will not get any use out of it without Impact Pack installed - the crop-region data type it consumes doesn't exist without that pack.
How it works
Impact Pack's SEG (segmentation) detections carry their own crop-region metadata - where in the original image that detected region sat. If you've been editing a mask inside that crop (fixing a SAM2 selection, painting over a bad detail pass, whatever), the mask you're holding is sized to the crop, not the original image. This node takes that cropped mask plus the crop-region data and expands it back out to full-image dimensions, filling everything outside the restored region with a flat value you control.
The inputs and outputs that matter
reference_image(required, IMAGE) - the full-size image the mask needs to be restored onto; it establishes the target dimensions.mask(required, MASK) - the cropped mask you want placed back.crop_region(required,SEG_ELT_crop_region) - the crop coordinates, sourced from Impact Pack's SEG data. This isn't a generic type; it's specific to Impact Pack's detection pipeline, which is the whole reason this node lives in theImpackPackcategory rather than the generalImageEditone.fill_color(default 0, range 0–255) - the value used outside the restored region. 0 (black/empty) is the sane default if the output is heading into a compositing node that treats black as "no mask."
One output: mask (MASK) - full-image-sized, with your edited region restored in place and everything else filled with fill_color.
Installing it
You need both packs. WJNodes itself:
cd ComfyUI/custom_nodes
git clone https://github.com/807502278/ComfyUI-WJNodes.git
cd ComfyUI-WJNodes
pip install -r requirements.txt
And, per the README's own note, Impact Pack is a hard requirement for this specific node - install ComfyUI-Impact-Pack (and, if you need YOLO-based detection feeding into it, the separately-installed Impact Subpack) via ComfyUI Manager or the same clone-into-custom_nodes pattern. Restart after both are in place.
Common issues & troubleshooting
Node won't even show up, or errors on load. SEG_ELT_crop_region is an Impact Pack type, not a WJNodes one - if Impact Pack isn't installed (or is an old version whose SEG structure changed), this node has nothing to attach to. Confirm Impact Pack loads cleanly on its own first.
Restored mask looks shifted or offset. Make sure crop_region is coming from the same detection pass as the mask you're feeding in. Mixing crop-region data from one SEG detection with a mask that was edited under a different detection's crop will place it in the wrong spot - the coordinates only make sense paired together.
Output looks entirely filled with fill_color and nothing restored. Check that mask genuinely contains the edited content you expect before it hits this node - a blank or all-zero mask restored back out will just look like a full-canvas fill, and it's easy to mistake that for the node failing when the input was already empty.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| reference_image | IMAGE | — | |
| mask | MASK | — | |
| crop_region | SEG_ELT_crop_region | — | |
| fill_color | INT | 00–255 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |