ComfyUI Node
CV White Balance (xphoto)
Removes a colour cast automatically (cv2.xphoto). 'simple' clips a percentage of the extreme pixels per channel and stretches the rest - fast and predictable. 'grayworld' assumes the scene averages to gray, which suits mixed scenes but over-corrects a legitimately one-coloured image (a sunset, a forest). 'learning-based' uses a small built-in regression model and is the most robust on real photographs. Colour-cast removal is what makes a reference photo usable as a style/colour source, so this is usually a PRE-processing step. Needs a 3-channel image.
CV White Balance (xphoto)
- image
- balanced
◄methodsimple►
◄clip_percent2.0►
◄saturation_threshold0.90►
Categoryimage/CV/contrib
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | COMFY_MATCHTYPE_V3 | Image with an unwanted colour cast. Must be 3-channel; the output echoes this input's format. Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size. | |
| method | COMBO | simple | Which balancer to use. Try 'simple' first; switch to 'learning-based' when the scene is genuinely dominated by one colour and 'grayworld' washes it out. |
| clip_percentopt | FLOAT | 2.00–49 | 'simple' only: percentage of the darkest and brightest pixels ignored per channel before stretching. 0 uses the absolute extremes, so a single blown pixel can ruin the balance; 1-5 is the useful range. |
| saturation_thresholdopt | FLOAT | 0.900–1 | 'grayworld' / 'learning-based' only: pixels whose saturation exceeds this are treated as already clipped and excluded from the estimate. Lower it to ignore more of a strongly coloured subject. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| balanced | COMFY_MATCHTYPE_V3 | White-balanced image, in the same format as the input. |