AdaIN Filter (Latent)
Local color matching for latents
- latents
- reference
- LATENT
This is the spatial sibling of AdaIN (Latent) - same underlying idea, but instead of matching your latent's overall color statistics to a reference in one global pass, it does the matching locally, filtered by neighborhood. The README puts it plainly: "works like a latent color match." Reach for this one when a single global color correction isn't cutting it because different regions of your image need different corrections.
How it's different from the non-filtered version
Plain AdaIN Latent computes one mean and one standard deviation for the whole image and shifts everything by that single global statistic. That's the right tool when the color drift is uniform - the whole frame trending warm, say. But some color problems aren't uniform: a shadow region needs a different correction than a highlight region. AdaIN Filter Latent applies a spatial filter instead of computing one global statistic, so the correction adapts locally across the image rather than applying the same shift everywhere.
Inputs and outputs that matter
latents- what you're correcting.reference- the latent whose color statistics you're matching toward.filter_size(1-128, default 1) - the size of the local neighborhood used for the spatial filter. At 1 it's close to a per-pixel comparison; push it up and the correction smooths out over a larger area, moving it closer to how the non-filtered AdaIN Latent behaves. This is the setting that actually decides how "local" versus "global" the correction feels.factor(-10 to 10, default 1) - strength of the correction. 1 is full strength; lower values blend partway between corrected and original.
Output: a single LATENT.
Installing it
ComfyUI Manager: search ComfyUI Image Filters. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/spacepxl/ComfyUI-Image-Filters
Restart. No model weights needed here - it's a statistical operation on tensors, no checkpoint involved. The pack-wide dependency worth knowing about is opencv: if node imports fail after install, it's usually a version conflict from another pack that also bundles opencv. The repo's import_error_install.bat fixes that by reinstalling all four opencv variants together; the manual equivalent is removing every opencv-* package and installing just opencv-contrib-python.
Where people get burned
filter_size is the setting people either skip entirely (leaving it at the default of 1, which barely differs from a straight AdaIN Latent) or crank without understanding what it does. If your correction looks patchy or inconsistent across the image, you probably want a larger filter_size, not a different factor. If it looks like the local variation you were trying to fix got smoothed away entirely, you've gone too far the other direction.
The other trap is applying this when your color problem is actually global, not local - in that case AdaIN Latent, the non-filtered node, is simpler, cheaper, and gives you the exact same result with fewer knobs. Save this one for when you've actually confirmed the drift varies across the image.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| latents | LATENT | — | |
| reference | LATENT | — | |
| filter_size | INT | 11–128 | — |
| factor | FLOAT | 1.00-10–10 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |