π Unstitch Images and Mask
Unstitch the composite and its mask in one step
- unstitch
- image
- mask
- IMAGE
- MASK
The mask companion to UnstitchImages. Where that node gives you one edited half back, this one gives you the edited half and its mask in the same slice - which is exactly what you want when your next step is compositing the result back over the original. If you stitched with StitchImagesAndMask, this is how you take it apart again.
It's the final leg of the pack's FaceSwap-style workflow: stitch image+mask, edit the composite, unstitch with this node, then paste the edited slice over the source using the mask that comes back with it. Because both image and mask are sliced with identical coordinates, the alpha boundary lines up with the pixels - no re-alignment, no guessing.
How it works
Same slice math as UnstitchImages, but applied to two tensors at once. It reads the UNSTITCH metadata (direction, original shapes, spacing), computes where image 1 ends and image 2 begins in the composite, and cuts both the image and mask inputs along that seam. The selection input ("1" or "2") picks which half you get back; both the image and the mask come from the same half, so they stay in sync.
Inputs: unstitch (metadata from a StitchImagesAndMask), image (edited composite), mask (edited composite mask), and selection. Outputs: IMAGE and MASK.
Install
ComfyUI Manager (search "YarvixPA") or
cd ComfyUI/custom_nodes
git clone https://github.com/YarvixPA/ComfyUI-YarvixPA
restart. Under ComfyUI-YarvixPA/Image/Stitch.
The pattern, end to end
StitchImagesAndMaskjoins your two images and masks, and remembers the geometry.- Edit the composite (inpaint the seam, swap the face, whatever).
UnstitchImagesAndMaskslices the edited half and its mask back out.- Composite the edited slice over the original with the mask.
The mask coming out of this node is the compositing key - it marks precisely the region that was part of the edited half, so your paste doesn't leave a hard seam. Same caveat as the rest of the family: the metadata is pack-specific and the node trusts it blindly, so keep the unstitch wire intact and only feed it composites produced by this pack's stitch nodes.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| unstitch | UNSTITCH | β | |
| image | IMAGE | β | |
| mask | MASK | β | |
| selection | COMBO | 1 | Choose which slice to output: 1=first, 2=second |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | β |
| MASK | MASK | β |