Nodes/ComfyUI/LatentApplyOperation
ComfyUI Node Runs on cloud

LatentApplyOperation

Run a latent filter once, before sampling

By Comfy-Org·Created 4 years ago·Updated about 2 hours ago· 129,820
LatentApplyOperation
  • samples
  • operation
  • LATENT

LatentApplyOperation is the experimental node that takes a latent and a LATENT_OPERATION and applies that operation to the latent - once, up front. It's the "apply a filter to your latent" tool, where the filter is defined by separate nodes like LatentOperationSharpen. Think of it as a batch of latent-space image-processing nodes (sharpen, and friends that will presumably join it) unified behind one generic interface: hand it a latent, hand it an operation, get the transformed latent back.

The two inputs: samples (the LATENT) and operation (a LATENT_OPERATION, which comes out of a node like LatentOperationSharpen). Output is the filtered LATENT. Nothing else to configure - the operation carries all its own parameters.

Why "once, up front" matters

The point of the pre-sampling variant is that it runs before the KSampler, transforming the latent you feed in. The classic use is sharpening an img2img source: encode an image, sharpen its latent, then sample from the sharpened latent to claw back detail. Because it's a one-shot transform of the input, it's cheap and predictable - you can see exactly what the operation did before the sampler touches it. That's the honest use case: a "make the starting latent crisper" step in a pipeline that's doing a detail pass.

The naming distinction with its sibling is the important part. LatentApplyOperation applies to the latent directly; LatentApplyOperationCFG applies the same operation to the model, so it runs during every sampling step on the guidance direction instead of once at the start. If you want sharpening that compounds through the whole denoise, you want the CFG variant. If you want a single, debuggable transform of the input, you want this one.

The honest caveats

This is marked experimental in the source, and it shows in the ergonomics. The LATENT_OPERATION type is opaque - you can't see or preview what the operation node produced, only apply it. There's also no masking here: whatever the operation does, it does to the whole latent uniformly. And because it operates in latent space rather than pixels, the effect isn't directly visible until you decode - which makes tuning parameters (radius, sigma, alpha on the sharpen node) a decode-and-check loop rather than an interactive slider. Budget for that.

It ships with ComfyUI core - no install, no model files. If you're not doing latent-space filtering, you'll likely never open it; if you are, it's the clean way to compose "apply this filter" without reimplementing the transform. Just remember: experimental, whole-latent, pre-sampling. The CFG sibling is the one that reaches into the sampler itself.

Categorymodel/latent/advanced/operations

Inputs (2)

NameTypeDefaultDescription
samplesLATENT
operationLATENT_OPERATION

Outputs (1)

NameTypeDescription
LATENTLATENT