😺NKD Perspective Rewarp
Put the Edit Back, at the Angle It Belonged
- image
- warp_data
- image
- mask
Perspective Unwarp is the easy half of the trick - flatten a poster, edit it head-on, feel clever. Rewarp is the half that decides whether the result looks real or looks pasted on. It takes your edited flat image and composites it back into the original photo at its quad, warped to the original perspective and feathered at the edge so the join disappears.
How it works
The warp_data cable from Unwarp carries the homography, and Rewarp inverts it: every pixel of your flat edit is sampled back into the photo's frame, exactly reversing the flattening. Then it does the compositing work that separates "looks real" from "looks like a sticker":
- feather softens the quad edge in pixels (default 8) - without it, the edit ends in a hard line.
- edge_hardness pushes that feathered edge back toward hard, which sounds contradictory until you hit the actual failure mode: too much feather and the original background ghosts through as a halo. It's the finesse dial for that.
- match_colors pulls the edit's colors toward the original (0–1), for when your inpaint rendered the poster a slightly different white under the same lighting.
- seamless_edges runs an extra seam-erase pass to kill the last blend artifacts. It's the one thing that requires OpenCV - and if you don't have it, the rest of the node works fine, it just skips that pass. The README is clear about this: optional.
There's also transparent_bg: instead of compositing onto the original, output the warped element on RGBA transparency for external compositing. It skips match colors and seamless edges (those blend against a background by definition), so you get a clean element to drop into After Effects or wherever.
The inputs that matter
- image - the edited flattened image, straight from your inpaint or img2img.
- warp_data - from the Unwarp node that made the flat. No warp_data, no return trip; this is a required input, which is the right design because it's what makes the warp exact.
- feather / edge_hardness / match_colors - the three seams to fight, in that order of how often you'll touch them.
Outputs: image (the original photo with your edit warped back, or the element on transparency) and mask - the quad's feathered alpha, which is exactly what you want if you're doing the final composite yourself.
Install and troubleshooting
Installs with the pack: ComfyUI Manager, search "NKD VFX Tools", restart. No models. If your edit looks stamped-on, work the feather/hardness/color trio before you blame the geometry - a visible quad outline is a blend problem, not a warp problem. And if you switched seamless_edges on and see no difference, that's the OpenCV check staring back at you.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | The edited flattened image. | |
| warp_data | NKD_WARPDATA | — | |
| feather | INT | 80–256 | Soften the quad edge, in pixels. |
| edge_hardness | FLOAT | 0.000–1 | Firm the blend edge to stop the original from ghosting through as a halo. |
| match_colors | FLOAT | 0.000–1 | Pull the edit's colors back toward the original. |
| seamless_edges | BOOLEAN | false | Extra seam-erase pass. Requires OpenCV. |
| transparent_bg | BOOLEAN | false | Output the warped element on transparency (RGBA) instead of compositing it onto the original — for external compositing. Skips Match Colors / Seamless Edges (they blend against the background). |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | Original photo with the edited region warped back, or the element on transparency (RGBA) if Transparent Background is on. |
| mask | MASK | The quad's alpha (feathered), for compositing. |