Nodes/MdColorMod/Color Temperature (MD)
ComfyUI Node

Color Temperature (MD)

Fix a too-blue or too-yellow render in two Kelvin numbers

By MdONeilsl·Created 2 months ago·Updated 2 months ago· 0
Color Temperature (MD)
  • image
  • mask
  • image
original_temp6500
intended_temp6500

Diffusion models have opinions about white balance, and they're not always yours. A render comes out sickly blue because the model leaned cold, or amber because it leaned warm, and your options are usually "live with it" or "re-generate and hope." mdColorTemperature gives you the third option: tell it the color temperature the image looks like it was shot at, tell it what you want instead, and it rebalances the white point. Two numbers, no model, done.

How it works

The node converts both Kelvin values to linear-RGB white points using the Tanner Helland black-body approximation - the standard formula that turns a temperature like 6500K into an r/g/b balance (low Kelvin is warm orange, high Kelvin is cold blue). It then computes the ratio of intended to original white point, normalizes so overall luminance doesn't jump, and multiplies the image's RGB channels by those gains. Because the conversion happens in linear light, the result is a proper white-balance shift rather than a colorized wash. Alpha is preserved, and the optional mask lets you rebalance just the sky, just the skin, or one character while leaving the rest alone.

The inputs that matter

  • image - your IMAGE.
  • original_temp - 1000 to 40000 K, default 6500. What you believe the current white balance represents. If the image looks neutral-ish, 6500 (daylight) is the right starting point.
  • intended_temp - same range, default 6500. Where you want it to land.
  • mask - optional.

Both temps at 6500 is a no-op by design - you're telling it "no change needed." The direction is intuitive once you stop overthinking it: lower the intended temp to make the image warmer, raise it to make it cooler. An image that's too blue wants a lower intended temp; too yellow wants a higher one.

Install

Standard MdColorMod, zero dependencies, no model files:

cd ComfyUI/custom_nodes
git clone https://github.com/MdONeilsl/ComfyUI-MdColorMod

Restart, or install via ComfyUI Manager by searching "MdColorMod". Nodes appear under md.

Where people get burned

The usual confusion is reversing the direction and then fighting the sliders. Get it backwards once and the fix becomes "make it warmer" and the image gets colder, so you keep cranking and end up with a sodium-vapor lamp. Commit to a direction, move the temp by 1000–2000 at a time, and check against a reference. Also know your landmarks: candlelight is ~2000K, tungsten ~3200K, daylight ~6500K, open shade ~7500K+. If the model keeps giving you that sterile cool look, nudging intended from 6500 down to 5500 is often all it takes. There's no per-channel fiddling here - it's a clean white-balance tool, and if you need fine split-toning, that's a different node's job.

Categorymd/image/color

Inputs (4)

NameTypeDefaultDescription
imageIMAGEInput image tensor.
original_tempFLOAT65001000–40000Original color temperature of the scene in Kelvin.
intended_tempFLOAT65001000–40000Desired color temperature after adjustment in Kelvin.
maskoptMASKOptional mask to restrict the adjustment area.

Outputs (1)

NameTypeDescription
imageIMAGEThe white-balanced image.