HDR Inpaint Stitch
Putting a fixed patch back without a visible seam
- original_image
- cropped_image
- cropped_mask
- stitcher_data
- stitched_image
- stitch_blend_mask
The standard inpainting move - crop the problem area, run it through a model at higher resolution, paste it back - has a failure mode everyone hits at least once: the paste shows. Not because the new pixels are bad, but because the boundary is wrong. A hard-edged mask gives you a visible rectangle. A soft mask in 8-bit SDR space gives you a bright halo, because you're averaging two images that don't share a linear scale.
HDR Inpaint Stitch is the paste-back half of a crop-and-stitch workflow, and it's built for scene-linear data that doesn't fit in [0, 1].
How it works
It takes the full-size plate, the processed crop, the mask that says which part of the crop matters, and the coordinates from Radiance's HDR Crop node, then blends the crop back in unclamped - the output can still hold values above 1.0.
Around that it wraps three blend modes:
- Linear_Laplacian (default) - a 3-level multi-band blend. The image and the mask are each decomposed into a Laplacian pyramid, the bands are mixed with the mask at each level, and it's all reconstructed. Low frequencies cross-fade slowly; high frequencies swap almost at the mask edge. That's what kills the halo, and it's why this is the default rather than the "normal" one. Negatives are clamped to zero at the end, nothing else.
- Linear_Gaussian and Standard - plain mixes through the feathered mask. Cheaper, and honest about it.
feather_radius (default 16, up to 128) softens the mask with a box blur of 2 * radius + 1 before any blend mode touches it; 0 uses your mask exactly as it arrived. Every mode uses it, so if you get a hard seam it's worth checking here before you start blaming the model.
Inputs and outputs
Four inputs carry data and two are knobs. The data ones: original_image, cropped_image (which must keep the crop's exact width and height - it's pasted at the stored coordinates), cropped_mask, and stitcher_data from HDR Crop. Then blend_mode and feather_radius.
Outputs are stitched_image and stitch_blend_mask. That second one is more useful than it sounds: it's the actual mask that was used after feathering and, in Laplacian mode, after multiband mixing - wire it into a Viewer when a seam looks odd and you can see whether the problem is your mask or your crop.
One thing to state plainly: no transfer conversion is applied. Whatever encoding the crop is in, it stays in. If your inpaint model produced sRGB pixels and your plate is scene-linear, you will stitch a gamma mismatch into the image and it'll look like a faint bright rectangle forever. Convert the crop to match the plate first.
Installing Radiance
Manager → search Radiance → install → restart ComfyUI → refresh the browser. Manual install:
cd ComfyUI/custom_nodes
git clone https://github.com/fxtd-studios/radiance.git
cd radiance
python -m pip install -r requirements.txt
Windows portable: use python_embeded\python.exe for that pip line. The pack is GPL-3.0, ~147 visible nodes, and pulls OpenEXR, OpenImageIO, OpenColorIO, diffusers and accelerate. Nothing extra downloads for this node specifically.
Troubleshooting
A visible rectangular edge. Almost always feather_radius too low for the resolution you're working at, or a crop that doesn't match the stored coordinates. Guessing coordinates by one or two pixels is enough to smear the whole seam.
A bright or dark halo around the patch. Two causes, and they look similar. Either the crop is in a different encoding than the plate (see above), or the crop's black level drifted during inpainting - diffusion inpainters lift blacks. Check a flat region of the crop against the same region of the plate.
Ugly edges that no amount of feathering fixes. Flip to Standard. If the plain mix looks better than the Laplacian one, the two images disagree structurally more than they disagree in detail, and multi-band blending faithfully preserves that disagreement.
Nothing blends and you can see a hard cut. Your cropped_mask is binary and feather_radius is 0. Set the feather to something real.
If you're compositing a whole CG element rather than a repaired patch, this isn't the node - Multipass Composite handles alpha-over with depth holdout, shadows and light wrap. This one is specifically for the crop-and-return loop.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| original_image | IMAGE | The full-size plate that was passed to HDR Crop. | |
| cropped_image | IMAGE | The processed crop. It must keep the crop's exact width and height, as it is pasted back at the stored coordinates. | |
| cropped_mask | MASK | Mask for the crop (normally cropped_mask from HDR Crop). Only this area of the crop replaces the plate. | |
| stitcher_data | STITCHER_DATA | Crop coordinates from HDR Crop. | |
| blend_mode | COMBO | Linear_Laplacian | Linear_Laplacian: 3-level multi-band blend with the feathered mask, negatives clamped to 0. Linear_Gaussian and Standard: plain mix through the feathered mask. No transfer conversion is applied. |
| feather_radius | INT | 160–128 | Mask softening radius in pixels (a box blur of 2 x radius + 1), used by every blend mode. 0 preserves the input mask without softening. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| stitched_image | IMAGE | — |
| stitch_blend_mask | MASK | — |