Nodes/ComfyUI-Image-Analysis-Tools/Color Temperature Estimator
ComfyUI Node

Color Temperature Estimator

Your render thinks it's 6643K — is that the light you wanted?

By ThatGlennD·Created about a year ago·Updated about a month ago· 23
Color Temperature Estimator
  • image
  • kelvin
  • temperature_label
  • color_swatch

Photographers talk about color temperature in Kelvin - 3200K for tungsten, 5500K for daylight, 7000K+ for shade - and it's the vocabulary that makes "this render is too cold" into a number you can act on. Color Temperature Estimator gives you that number for any image: it computes the average white point, converts it to a Kelvin temperature, and hands you a swatch of the actual tint so you can see what "6643K" means as a color.

It's part of ThatGlennD's ComfyUI-Image-Analysis-Tools pack, and it's one of the simplest nodes there - a single image in, three outputs out, no knobs to fiddle. Which is either refreshing or a hint that it's a one-trick pony. It's a mean measurement, and you should read it as such.

How it works

The average RGB of the whole frame is converted to CIE 1931 XYZ, mapped to chromaticity coordinates (x, y), and run through the classic McCamy polynomial (the "Robertson approximation" the README mentions) to produce a correlated color temperature. The result lands in the kelvin output as a rounded integer.

Based on that number, temperature_label gives you one of four buckets: Warm (under 3000K), Neutral (3000–4500K), Cool Daylight (4500–6500K), or Blueish / Overcast (over 6500K). The color_swatch output is a small matplotlib image - a solid fill of the computed white point with the Kelvin value overlaid in black or white, whichever stays legible. Wire it to a preview and you've got a tiny color card sitting in your graph.

What to actually use it for

  • Comparing lighting tone across renders - the classic "did this LoRA warm things up?" question, answered with one number per run.
  • Consistency checking in a multi-frame or multi-image pipeline, where drift of a few hundred Kelvin between otherwise-matching shots is a real tell.
  • Sanity-checking a LUT or white-balance pass you just applied - did it move the temperature where you thought it did?

The caveat is baked into the mechanism: it's a single mean over the whole image. A scene with mixed lighting - warm lamp, cool window - averages to some compromise number that represents nothing in particular. And a stylized teal-and-orange grade will read as "bluish" even though it's deliberate. This node measures the average emotional color tone, not the correctness of any one light source. Use it for relative comparisons between images generated under the same recipe; that's where it's reliably honest.

Install

Standard for this pack - ComfyUI Manager (search "Image Analysis") or:

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. Requirements are numpy, opencv-python, matplotlib, scikit-learn, Pillow and torch - nothing exotic, no model files. Note the pack loads all its node modules at startup, and the Color Harmony Analyzer imports scikit-learn at module level, so a missing scikit-learn will prevent all nodes (this one included) from appearing. Windows portable: python_embeded\python.exe -m pip install scikit-learn.

Common gotchas

  • Nodes missing after install: scikit-learn or a stale ComfyUI (this pack needs the newer comfy_api node API - update ComfyUI first).
  • A single odd Kelvin value: check what's actually in the frame. Mean-based CCT gets dragged around by large bright areas; a sky-heavy image will read colder than the subject does.
  • First frame only: batches are averaged on frame 0; process video frames individually.

Pair it with the Color Cast Detector from the same pack - temperature tells you how warm the light is, cast detection tells you whether the channels are balanced around it. Between them, most "why does this look green/blue/wrong" questions get a number instead of a vibe.

CategoryImage Analysis/Color

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (3)

NameTypeDescription
kelvinINT
temperature_labelSTRING
color_swatchIMAGE