Nodes/MdColorMod/Color Auto White Balance (MD)
ComfyUI Node

Color Auto White Balance (MD)

Auto white balance without leaving ComfyUI

By MdONeilsl·Created 2 months ago·Updated 2 months ago· 0
Color Auto White Balance (MD)
  • image
  • mask
  • image

That's the node for it: mdColorAutoWhiteBalance, the GIMP Colors → Auto → White Balance operation, ported to a ComfyUI node with zero parameters. Point it at an image that's too yellow under a warm light, too blue in the shadows, or just carrying a cast you can't name, and it estimates the offending light source and compensates.

How it actually works

Auto white balance assumes the average scene should be gray - midtones average out to neutral when there's no dominant light color. This node implements GIMP's approach: a percentile stretch on each RGB channel. Instead of shifting every channel to the same mean (which kills contrast), it looks at the per-channel distribution, finds the darkest and brightest pixels that still matter, and stretches each channel's range independently so the low and high ends land on neutral black and white. The channel that's boosted in the shadows is the one that's off - that's the color cast, and it gets scaled out.

Where it beats a fixed temperature slider: temperature is one knob and only moves the image along the blue-yellow axis. White balance handles the combination of casts across all three channels, including the green-magenta axis that a temperature slider can't touch.

The interface

There is almost nothing to configure:

  • image - required.
  • mask - optional, and here it's used as a weighting mask for the percentile statistics. If you only want the neutral estimate to come from the skin tones or from a white card region, mask the rest away. The mask is also interpolated to image size internally, so shape mismatch isn't the foot-gun it is on some siblings in this pack.
  • Output: image, same shape, alpha untouched.

The workflow move

This is the right first step when a render's colors are "off" but you can't articulate how - before you start slinging saturation or hue sliders. One honest caveat from using auto-white-balance-style fixes: it assumes there is a cast. Feed it a scene that's genuinely dominated by one color (a sunset, a red-lit room) and it'll try to "fix" the mood out of it. That's not a bug, it's the assumption. If you want to keep the atmosphere, gate the effect with a mask or reach for the manual mdColorBalance node instead. Our post-processing notes frame all of these as deterministic, no-model fixes that belong in every finishing pass - this is one of the best of the breed.

Installing

Same story as the whole pack - Manager search "MdColorMod", or:

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

restart. Empty requirements.txt, pure torch, no models, GPL-3.0. The pack is new - roughly a month old with essentially no community chatter - so if Manager can't see it yet, clone it manually and you're good.

Categorymd/image/color

Inputs (2)

NameTypeDefaultDescription
imageIMAGEInput image tensor.
maskoptMASKOptional mask to restrict the adjustment area.

Outputs (1)

NameTypeDescription
imageIMAGEThe white-balanced image.