Color Cast Detector
Why does everything look green? A number would help
- image
- cast_score
- color_bias_map
- interpretation
You've generated a photoreal portrait and something is off. The skin has a green undertone, or the whole frame leans magenta, and no amount of squinting tells you how bad it is. Color Cast Detector quantifies it: it tells you which color channel is out of whack, how far from neutral the image sits, and draws you a map of where the bias lives.
It's part of ThatGlennD's ComfyUI-Image-Analysis-Tools suite, and like the rest of the pack it's pure pixel math - no model, no VRAM, no downloads. Where the Color Temperature Estimator in the same pack tells you the warmth of the light, this node tells you the imbalance: a scene can be warm and still perfectly balanced, or technically neutral and badly tinted.
How it works
The node computes the mean RGB of the whole image, normalizes it, and compares each channel against a perfectly neutral 1/3-1/3-1/3 split. cast_score is the largest deviation. If that score stays under tolerance (0.01–0.5, default 0.05), you get "No significant color cast"; above it, the interpretation string names the dominant and weakest channels and guesses the cast family - things like "Possible magenta/green cast" for a red/green imbalance.
The visualization_mode combo switches how the map is built:
- Channel Difference (default): computes per-pixel differences between channel pairs (R–G, G–B, R–B). Good for spotting tints that come from uneven channel amplification.
- Neutrality Deviation: measures how far each pixel strays from gray/white balance. Better for a global bias that's strongest in highlights and midtones.
Both produce color_bias_map when visualize_color_bias is on. The interpretation string - "No significant color cast" or "Color cast detected: Red tint (ΔRed = 0.11) → Possible cyan/red cast" - is the output you'll actually read at a glance.
Where it earns its keep
- Skin tones. A magenta/green imbalance shows up in faces first, and this is the fastest way to prove you have one instead of eyeballing it.
- Post-processing drift. After a LoRA, a LUT, or an inpainting pass that re-rolled colors, cast detection is a cheap sanity check against the original.
- White-balance shifts on generated "photo" content that's supposed to look shot under real light.
The caveat: this is a mean-based metric, so a deliberately moody grade - teal shadows, orange highlights - will read as a strong cast even when it's exactly what you wanted. Use it to catch unintended bias, not to police intentional style.
Install
Manager (search "Image Analysis") or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ThatGlennD/ComfyUI-Image-Analysis-Tools
cd ComfyUI-Image-Analysis-Tools
pip install -r requirements.txt
Restart ComfyUI afterward. Dependencies are numpy, opencv-python, matplotlib, scikit-learn, Pillow and torch - all standard ComfyUI venv furniture, no model files.
Common gotchas
- Pack won't load: the whole suite imports every node module at startup, and scikit-learn is imported at module level by the Color Harmony Analyzer. Missing scikit-learn = no nodes at all. Windows portable:
python_embeded\python.exe -m pip install scikit-learn. comfy_apiimport error: the pack needs ComfyUI's newer node API; update ComfyUI before anything else.- First frame only: batches are scored on frame 0; feed frames one at a time for video.
One practical workflow: wire interpretation into a text display next to the image, run a grid of candidate settings, and watch the cast label change as you tune. That's the whole loop - see the bias, name it, fix it.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| tolerance | FLOAT | 0.050.01–0.5 | — |
| visualize_color_bias | BOOLEAN | true | — |
| visualization_mode | COMBO | Channel Difference | 2 options: Channel Difference, Neutrality Deviation |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| cast_score | FLOAT | — |
| color_bias_map | IMAGE | — |
| interpretation | STRING | — |