Nodes/ComfyUI MultiPoint White Balance/Apply White Balance Gain
ComfyUI Node

Apply White Balance Gain

Where your gray-balance fix actually lands on the image

By MengYe-Z·Created 4 months ago·Updated 4 months ago· 1
Apply White Balance Gain
  • images
  • balance_data
  • IMAGE

Apply White Balance Gain is the boring half of the MultiPoint White Balance pack - and that's a compliment. The interesting half is GrayBalanceFromPoint, which turns points you clicked on a background into three numbers: r_gain, g_gain, b_gain. This node's entire job is to take those three numbers and multiply the red, green and blue channels of your image by them. Color cast in, neutral image out.

What it's for

If you've ever shot product photos on a white background that came out slightly yellow, greenish, or blue under mixed lighting, you know the fix isn't a filter - it's a white-balance correction. The classic photography method is the gray card: measure a neutral reference, compute what color shift makes it gray, apply that shift everywhere. This pack replaces the physical gray card with pixels. GrayBalanceFromPoint measures, and Apply White Balance Gain applies. It exists so the measurement and the application can operate on different versions of the image - measure on a blurred copy to dodge noise, apply to the sharp original for full detail.

How it works

Dead simple mechanism: parse the balance_data JSON, read r_gain/g_gain/b_gain (defaulting each to 1.0 if anything's wrong), multiply each channel independently, clamp to 0–1. Because the gains are per-channel, a warm cast gets its over-hot red channel scaled down and its cool blue scaled up until the sampled points' average hits neutral gray. That's the entire "white balance" in math.

The inputs that matter

  • images - the original sharp image. This is the whole point of the two-stage design: don't feed the blurred copy here, or you're sharpening nothing and just smearing the correction.
  • balance_data - the JSON string output from GrayBalanceFromPoint (r_gain, g_gain, b_gain). Wire it straight across.

Output is a single IMAGE. That's it. One input pair, one output.

Install

Same as every node in the pack - it comes bundled:

cd ComfyUI/custom_nodes
git clone https://github.com/MengYe-Z/ComfyUI-MultiPointWhiteBalance.git

or ComfyUI Manager → Install Custom Nodes → search "ComfyUI MultiPoint White Balance" → restart. No models, no heavy deps, pure torch. You do need KJNodes installed, since its PointsEditor supplies the coordinates that the compute node consumes.

Where people get burned

Same silent-failure trap as its exposure sibling: if balance_data fails to parse, the node logs a warning and falls back to gains of 1.0 - a no-op, not an error. If your corrected image looks identical to the source, that's the first thing to check.

Second, this node corrects the entire image. If your product itself contains white areas, they get "corrected" too. The README's answer is to mask: run the original through a segmentation node (BiRefNet is the default these days), invert the mask to get a background mask, and composite the corrected background with the untouched foreground. The node is blunt; the workflow around it is where the precision lives.

Categoryimage/color

Inputs (2)

NameTypeDefaultDescription
imagesIMAGE
balance_data*JSON string from GrayBalanceFromPoint (r_gain, g_gain, b_gain)

Outputs (1)

NameTypeDescription
IMAGEIMAGE