Nodes/comfyui-fvmtools/K2 Edit Composite
ComfyUI Node

K2 Edit Composite

The last, defensive step of a regional edit

By ping1979ping·Created 6 months ago·Updated about a month ago· 0
K2 Edit Composite
  • source
  • edited
  • mask
  • image
  • mask
composite_feather48
strength1.00

K2 Edit Composite is the finishing node of the regional-editing pipeline in the K2 Lab suite of comfyui-FVMtools. It takes the image you edited and composites it back over your original source using a feathered mask - and the detail that makes it worth its own node is that pixels outside the mask are copied byte-exact from the source. A regional edit can never degrade the rest of the image through VAE round-trip loss, because the untouched parts are never touched at all.

That's the masked-inpainting superpower the whole edit-model wave can't match: bit-identical unmasked pixels. K2 Edit Latent does the latent-side editing, and this node does the pixel-side protection that makes the "only the box changed" promise real.

The inputs

  • source - the original image. Everything outside the mask is copied from here unchanged.
  • edited - the result of the edit pass (typically your sampled + VAE-decoded output).
  • mask - where the edit is allowed. Connect the edit_mask output of K2 Edit Latent; that's its intended pairing.
  • composite_feather - the pixel-space blend width (default 48). Narrower than the latent feather on purpose: the latent feather blends during denoising, this one softens the pixel boundary afterward.
  • strength - opacity of the edit, 0..1. 1 is a full edit, 0 returns the source. A strength between is a manual "tone it down" dial, which is occasionally exactly what a too-strong regional change needs.

Outputs: image (the composited result) and mask (the same mask passed through, handy for chaining or inspection).

The full edit chain

IMAGE → K2 Edit Latent → K2 Regional Sampler → VAE Decode → K2 Edit Composite → Save

Start at low denoise, 64 px latent feather, 48 px composite feather. If a seam shows up, the author's guidance is to widen a feather or enlarge the box rather than raise denoise - seams on regional edits are usually a boundary problem, not a strength problem.

Install

Same as the whole pack:

cd ComfyUI/custom_nodes
git clone https://github.com/ping1979ping/comfyui-FVMtools

Restart ComfyUI, find it under FVM Tools/K2. No extra dependencies.

It's a small node with a small job, and it's easy to underrate. Skip it and paste the decoded edit over the source with a generic composite node and you'll see the difference: the generic node blends everything, so the parts you never asked to change come back slightly different. This node exists specifically so that doesn't happen.

CategoryFVM Tools/K2

Inputs (5)

NameTypeDefaultDescription
sourceIMAGEOriginal image — everything outside the mask is copied from here unchanged.
editedIMAGEResult of the edit pass.
maskMASKWhere the edit is allowed (K2 Edit Latent output).
composite_featherINT480–512Pixel-space blend width. Narrower than the latent feather on purpose.
strengthFLOAT1.000–1Opacity of the edit. 0 returns the source.

Outputs (2)

NameTypeDescription
imageIMAGE
maskMASK