Nodes/Easy Color Correction/VAE Color Corrector
ComfyUI Node

VAE Color Corrector

Fixing the color shift your inpainting pass leaves behind

By regiellis·Created about a year ago·Updated 6 months ago· 158
VAE Color Corrector
  • original_image
  • processed_image
  • vae
  • mask
  • corrected_image
correction_strength0.80
methodluminance_zones
auto_preservetrue
lock_input_imagefalse
edge_feather5

Run an inpaint, and the patched region often comes back a slightly different color than the rest of the image - a warmer face, a greenish patch, a subtle mismatch you can't quite name but can absolutely see. That's not your prompt or your model being weird. It's the VAE. VAEColorCorrector is built specifically to undo it.

What it is and why you'd reach for it

Every trip through a VAE - encode to latent, decode back to pixels - is lossy. It's not a color filter, it's a compressed round trip, and it drifts. The community's own explanation of this is blunt: "VAE encoding AND decoding is not a lossless process. Each time you do it, your whole image gets a little bit degraded." The classic symptom in ComfyUI is the "grey box around the face" people get from ADetailer-style face-fix passes - the inpainting VAE cycle shifts color in exactly the masked region while the rest of the image, which never got re-encoded, stays put. The standard community fix is to composite the corrected region back onto the original pixels instead of trusting the full decode. VAEColorCorrector automates a more thorough version of that idea: instead of a blind pixel composite, it analyzes the color bias the VAE introduced and corrects for it directly.

How it works

You give it the image from before the VAE touched it and the image from after, and it picks one of four correction methods. Luminance zones - the recommended default - separates the image into shadows/midtones/highlights and corrects each zone's color bias the way a professional colorist would, rather than applying one flat correction. Histogram matching and statistical matching align color distributions or channel statistics between the two images. Advanced 3D LUT builds a k-means-based 3D color mapping - most accurate, also the slowest. Whichever method, the node first analyzes bias severity (low/medium/high) across luminance zones and scales correction strength accordingly, so a mild shift doesn't get over-corrected.

The inputs and outputs that matter

Two required image inputs carry the whole idea: original_image (before VAE encode) and processed_image (after VAE decode, with the shift). method picks the four-way approach above - start with luminance_zones, per the author's own recommendation. correction_strength (default 0.8) controls how hard the fix leans in; 0 is a no-op, 1 is full correction. auto_preserve (default on) tries to auto-detect which areas were actually inpainted so it doesn't "correct" parts of the image the VAE never touched - you can override this with an explicit mask (white = preserve) and feather the transition with edge_feather. There's also an optional vae input - passing the actual VAE model used helps it reason about VAE-specific bias rather than generic color statistics. lock_input_image caches both inputs so you can tune correction_strength and method repeatedly without ComfyUI re-running everything upstream - genuinely useful here since you're often iterating on the correction, not the generation. Output is a single corrected_image, which is what you'd feed to Save Image in place of the raw VAE decode.

How to install it

Via ComfyUI Manager: search "Easy Color Correction" and install the pack - this node comes bundled with it, no separate install. Manually:

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

then restart ComfyUI. This node's correction methods lean on scikit-learn (k-means for the 3D LUT method) and scikit-image/scipy - install the full requirements file rather than skipping it, or you'll be stuck on the simpler methods.

Common issues & troubleshooting

Where to wire it: original image → VAE encode → your inpaint/img2img pass → VAE decode → processed image, then both the pre-VAE original and the post-VAE processed image go into this node as its two required inputs. It's easy to accidentally feed it the same image twice - double-check you kept a copy of the true original before it went through the VAE.

Black squares in the output. This was a known quantization-artifact bug in earlier releases, since fixed with safe color clamping. If you're seeing it, update the pack.

Correction looks too aggressive or too weak. correction_strength at 0.8 is the author's tuned default - drop it if edges around the corrected region look unnatural, raise it if the shift is still visible.

3D LUT method is slow. That's expected - it's doing k-means clustering for a full 3D color mapping. Use luminance_zones for iteration and save the 3D LUT pass for a final render.

Categoryitsjustregi / Easy Color Corrector

Inputs (9)

NameTypeDefaultDescription
original_imageIMAGE🔴 Original input image (before VAE encoding)
processed_imageIMAGE🟡 Image after VAE decode (with color shifts)
correction_strengthFLOAT0.800–1🎚️ How strongly to correct VAE color shifts (0.0 = no correction, 1.0 = full correction)
methodCOMBOluminance_zones🔧 Color correction method: • luminance_zones: Professional shadows/midtones/highlights (recommended) • histogram_matching: Match color distributions • statistical_matching: Match color statistics • advanced_3d_lut: Most accurate but slower 3D color mapping
auto_preserveBOOLEANtrue🤖 Auto-detect and preserve inpainted areas when no mask is provided
lock_input_imageBOOLEANfalse🔒 Lock input images to prevent upstream nodes from reprocessing when adjusting correction parameters
vaeoptVAE🔧 VAE model used for encoding/decoding (helps with VAE-specific color corrections)
maskoptMASK⚫ Optional mask - white areas will be preserved (inpainted areas)
edge_featheroptINT50–50🌟 Feather edges between corrected/preserved areas (pixels)

Outputs (1)

NameTypeDescription
corrected_imageIMAGE