AdaIN (Image)
Fix color shift by matching statistics to a reference
- images
- reference
- IMAGE
AdaIN - Adaptive Instance Normalization - started life as a neural style-transfer technique: shift an image's per-channel mean and standard deviation to match a reference, and you transfer a surprising amount of the reference's color character without touching structure or content. Here it's used for exactly that statistical color match, applied directly to pixels. The README's own framing is the practical one: "useful for getting rid of color shift from high denoise strength, or matching color to a reference in general."
Why you'd want this
High-denoise img2img passes are notorious for color drift - push denoise strength up to get real structural changes and you often get a color cast along for the ride that has nothing to do with what you actually wanted to change. AdaIN Image fixes that after the fact: point it at your original (or any reference you want the color to match), and it pulls your generated image's overall color statistics back in line without needing to re-run the generation.
Inputs and outputs that matter
images- what you're correcting.reference- the image whose color statistics (mean and standard deviation, per channel) you want to match toward. Usually your source/original image, but doesn't have to be - any reference works, which is also how this doubles as a general color-matching tool between two unrelated images.factor(-10 to 10, default 1) - strength. 1 applies the full statistical match; lower values blend between original and matched; negative values push away from the reference rather than toward it.
Output: a single IMAGE.
Installing it
ComfyUI Manager: search ComfyUI Image Filters. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/spacepxl/ComfyUI-Image-Filters
Restart. Pure pixel-statistics math, so no model download. Watch for opencv conflicts on install, which is the one recurring dependency issue across this whole pack - other node packs frequently bundle a different opencv version, and ComfyUI won't tell you clearly which pack is at fault. Run import_error_install.bat from the repo to reinstall all four opencv variants in matching versions, or by hand: remove the opencv-* packages and install only opencv-contrib-python.
Where people get burned
This corrects global color statistics - mean and spread - not fine detail. If what you're actually missing is texture (skin pores, fabric grain, that kind of thing), AdaIN Image won't bring it back; that's a job for Restore Detail, from the same pack, which works via frequency separation instead of statistical matching. They solve different problems and are often used together: AdaIN to fix the overall color, Restore Detail to fix the missing texture.
The other place this trips people up is picking a bad reference. If your reference image itself has an unusual color palette - heavy stylization, a strong color grade, an odd lighting condition - matching toward it will import that palette into your result, which is either exactly what you want or a surprise, depending on whether you picked the reference deliberately.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| reference | IMAGE | — | |
| factor | FLOAT | 1.00-10–10 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |