Nodes/ComfyUI MultiPoint White Balance/Gray Balance from Point (Multi-point)
ComfyUI Node

Gray Balance from Point (Multi-point)

Fix color casts by clicking the background

By MengYe-Z·Created 4 months ago·Updated 4 months ago· 1
Gray Balance from Point (Multi-point)
  • images
  • positive_coords
  • image
  • balance_data

Gray Balance from Point (Multi-point) is the flagship node of the MultiPoint White Balance pack, and it's the closest thing ComfyUI has to a gray card for product photography. You click a few spots on a white or neutral background, it averages their color, and it computes three per-channel gains that drag that average to neutral gray. Clicking pixels instead of waving a card - and it works on pixels, so it works on your already-taken photos.

What it's for

E-commerce shots on white backgrounds get color casts: yellow from tungsten, green from fluorescent, blue from mixed window light. The fix is white balance, and the professional way to do it is to measure a known-neutral reference. This node is that measurement, done by sampling points you place on the background via KJNodes' PointsEditor. Multi-point is the point - one click samples a single dirty pixel or a highlight; several clicks average it all out into something you can trust. Sample four or five points in uniform, non-highlight, non-shadow areas and the noise largely cancels.

How it works

The math is honest and readable: it averages R, G and B separately across all your points, then sets target_gray to the mean of those three averages. Each channel's gain is target_gray / its average, so an over-hot channel gets scaled down and a cool one scaled up until the sampled points' average is neutral. The result is a JSON string with r_gain, g_gain, b_gain - plus the measured avg_source_rgb, target_gray and points_count for sanity checks.

The design that makes this pack worth installing is the two-stage split: you're encouraged to measure on a blurred copy. Stained or noisy white backgrounds get run through a strong blur (the pack's Gaussian Blur (Smooth), radius 15–40, or any blur node you prefer) so your measurements ignore dust and color noise - then the gains get applied to the original sharp image by Apply White Balance Gain. Measure on the noise-free version, apply to the real one. Clean background? Skip the blur, measure the original directly.

Inputs and outputs

  • images - what you're sampling. The blurred copy if the background is noisy, the original if it's clean.
  • positive_coords - must be wired to PointsEditor's positive_coords output. There's no text box; this is connection-only, and the tooltip is unambiguous about where it comes from.

Outputs: an image preview (the gains applied to whatever you fed in - preview only, not the final result) and the balance_data JSON, which is what you wire into Apply White Balance Gain along with your sharp original.

Install

Same as the rest of the pack:

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 meaningful pip deps - the code is pure torch. The hard prerequisite is KJNodes, since PointsEditor lives there.

Where people get stuck

Empty positive_coords raises "positive_coords is empty. Please connect PointsEditor output." - usually a forgotten wire. The gains are computed from the first image in the batch and applied to all of them, so keep batches homogeneous. And remember this corrects the whole frame: if your product has white parts, pair the output with a segmentation mask (BiRefNet is the community default) and composite so only the background is corrected. The gains are global - the workflow is where the precision lives.

Categoryimage/color

Inputs (2)

NameTypeDefaultDescription
imagesIMAGE
positive_coords*Connect PointsEditor positive_coords output

Outputs (2)

NameTypeDescription
imageIMAGE
balance_dataSTRING