A custom node pack for e‑commerce product photography. It provides precise white balance and exposure correction by manually selecting multiple points on a blurred copy of the image, then applying the calculated gains to the original sharp image.
- No coding required – visual point selection using
PointsEditor(from KJNodes). - Multi‑point averaging – robust correction by averaging RGB or luminance from several sample points.
- Background‑oriented – optimized for white/neutral backgrounds, avoiding interference from white foreground objects.
- Two‑step workflow – compute gains on a blurred copy (to suppress noise/texture), then apply them to the original sharp image.
- Separate white balance & exposure – independent nodes for color cast correction and overall brightness adjustment.
| Node Name | Category | Description |
|---|---|---|
Gaussian Blur (Smooth) |
image/filters |
Simple Gaussian blur. Useful for removing color noise or unevenness from white backgrounds. You may replace it with any other blur node. |
Gray Balance from Point (Multi‑point) |
image/color |
Compute white balance gains (r_gain, g_gain, b_gain) from points on a blurred image. Outputs JSON data. |
Apply White Balance Gain |
image/color |
Apply previously computed white balance gains to the original (sharp) image. |
Exposure Match from Point |
image/color |
Compute exposure gain (single luminance multiplier) from points on a blurred image. Outputs JSON data. |
Apply Exposure Gain |
image/color |
Apply previously computed exposure gain to the original (sharp) image. |
- Open ComfyUI → click
Manager→Install Custom Nodes - Search for
ComfyUI MultiPoint White Balance - Click Install, then restart ComfyUI.
cd ComfyUI/custom_nodes
git clone https://github.com/MengYe-Z/ComfyUI-MultiPointWhiteBalance.git- KJNodes custom node pack must be installed (provides the
PointsEditornode).
- Create a blurred copy of your image (only needed for noisy backgrounds – see below).
- On the image used for sampling (original or blurred), use
PointsEditorto add several green points on the background (white/neutral areas). - Connect the points to
Gray Balance from Point(orExposure Match from Point) to compute gains. - Feed the computed JSON gains together with the original (sharp) image into the corresponding
Apply…node. - Use a segmentation node (e.g., BiRefNet) to extract a foreground mask, and composite the corrected background with the original foreground.
- No blur is used. The original image is directly fed into
PointsEditorto select sample points on the background. - Gains (white balance or exposure) are computed from the original image and then applied to the same original image.
- A segmentation node extracts the foreground mask, and the corrected background is composited with the untouched foreground.
- This preserves sharp product details while evening out minor background color casts.
- A strong Gaussian blur is applied first (e.g., radius 15–40) to suppress color noise, dust spots, or uneven illumination.
- The blurred image is used only for point selection and gain calculation – the gains are then applied to the original sharp image.
- A foreground mask (e.g., from BiRefNet) ensures that only the background is corrected, leaving the product completely unchanged.
- This method effectively cleans heavily contaminated backgrounds while retaining full product detail.
positive_coords(must be connected toPointsEditoroutput)- Automatically computes the average RGB of all points and shifts it to neutral gray (R = G = B = average).
- Outputs a JSON string containing
r_gain,g_gain,b_gain, etc.
positive_coords(same as above)target_luminance– desired brightness of the sampled points (0 = black, 1 = white). Default0.9647≈ RGB 246.- Outputs a JSON string containing a single
gainvalue.
images– the original sharp image.balance_data/exposure_data– connect the JSON output from the corresponding compute node.
- Sample points should be chosen from uniform, non‑highlight, non‑shadow areas of the background.
- If the background has uneven illumination, a single gain may not make every point reach the target, but the average will match.
- For heavily stained or noisy backgrounds, always use a strong blur when computing gains.
- The output images from the compute nodes (
Gray Balance from Pointetc.) are only for preview; the final correction is applied via theApply…nodes.
If you need to brighten or color‑correct only the background while preserving the original foreground (product), you can incorporate a mask. For example:
- Use a segmentation node (e.g., 🔥BiRefNet,
Segment Anything, or any other matting tool) to extract a mask of the foreground. - Invert the mask to obtain a background mask.
- Apply the white balance or exposure gain using a
CompositeorApply Maskworkflow:- Keep the foreground unchanged.
- Apply the correction only to the background region (using the background mask).
This approach is especially useful when the product itself contains white areas that should not be altered. You are free to choose any segmentation node that works well with your images.
MIT License
- Thanks to KJNodes for providing the
PointsEditornode. - Inspired by real‑world needs in e‑commerce photography white‑balance correction.
Please open an issue on GitHub for questions or suggestions.