Nodes/ComfyUI-productfix/Detail transfer latent mode:add (middlek)
ComfyUI Node

Detail transfer latent mode:add (middlek)

Same trick, earlier in the pipeline

By MiddleKD·Created 2 years ago·Updated about a year ago· 21
Detail transfer latent mode:add (middlek)
  • target
  • source
  • mask
  • LATENT
blur1.00
blend_ratio1.000

DetailTransferLatentAdd is the frequency-separation trick from DetailTransferAdd, moved out of image space and into latent space. Same blur, same blend ratio, same optional mask - but it takes LATENT tensors in and hands you a LATENT back, so you can transplant fine detail between latents without ever round-tripping through the VAE.

How it works

The implementation is almost embarrassingly literal: it takes the samples from both latent dicts, permutes them from B,C,H,W into B,H,W,C (because the blur math was written for image tensors), runs the same add_detail_transfer routine - high-frequency detail from source, low-frequency base from target, blended by blend_ratio, masked if you pass one - then permutes back to latent layout and returns the dict.

That it works at all is a pleasant accident of how permissive the tensor math is. Latents aren't images, and a Gaussian blur over latent channels is not the same operation it is over pixels, but for transferring high-frequency structure it's close enough that the pack ships it and the demo workflows use it.

The inputs

  • target / source - both LATENT dicts. target keeps its broad structure, source donates its fine detail.
  • blur - Gaussian sigma, default 1.0. The blur band in latent space behaves differently than in pixels, so expect to tune it from scratch.
  • blend_ratio - default 1.0, range -10 to 10.
  • mask - optional MASK, applied the same way as the image-domain version.

Output: one LATENT dict, ready to wire back into a sampler or decoder.

When you'd actually use it

Honestly? Rarely. This is the "mode:add" variant of detail transfer that runs during sampling - if you're building a custom sampling loop where you want to enforce the original product's detail at a given step without leaving latent space, this is your tool. If you're doing the pack's standard workflow - regenerate, then fix the text afterwards - the image-domain DetailTransferAdd is simpler and behaves the way you expect. The latent version is for when the fix has to happen inside the denoise, not after it.

Install

Pack-wide, nothing special:

cd ComfyUI/custom_nodes
git clone https://github.com/MiddleKD/ComfyUI-productfix
pip install -r requirements.txt

Restart and it appears under the productfix category.

Gotchas

  • Blur/ratio tuning doesn't transfer between image and latent domains. If you've dialed in DetailTransferAdd at 0.9, don't expect the same numbers here to look equivalent.
  • Mask resolution - the mask is resized to the latent resolution, which is usually a fraction of the image size. Fine detail in the mask gets averaged away.
  • It expects the standard {"samples": ...} latent dict; anything else and it'll silently pass through unmodified content.

The honest read: this node exists to complete the "mode:add" pairing and to serve the pack author's own sampling experiments. Reach for it only if you know why you're reaching for it.

Categoryproductfix

Inputs (5)

NameTypeDefaultDescription
targetLATENT
sourceLATENT
blurFLOAT1.000.1–100
blend_ratioFLOAT1.000-10–10
maskoptMASK

Outputs (1)

NameTypeDescription
LATENTLATENT