RemoveWhiteBackgroundNoise
Snap the near-white junk to pure white
- images
- IMAGE
You know that look: a white-background image that isn't quite white - a paper scan with a faint gray cast, a product shot with sensor noise in the backdrop, a JPG that's gone slightly off-white where it should be flat. RemoveWhiteBackgroundNoise is a one-trick fix for exactly that: it takes every pixel brighter than a threshold you set and forces it to pure white. Clean backdrop, zero gray muddle, done.
It's the last of the Image-Toolkit's thresholding nodes, and worth a moment to understand what it does and doesn't do, because the name suggests more ambition than the code delivers. This is not background removal in the segmentation sense - it doesn't figure out where the subject is. It's a brightness floor: a thresholding pass that says "anything this light gets flattened to white." The subject itself is untouched, which is great when the subject is darker than the noise, and quietly wrong when it isn't.
How it works
The flow is short. The image goes to grayscale via the pack's OpenCV helper, then cv2.threshold applies a plain binary threshold: pixels above your threshold value are marked, and every one of those pixels gets its RGB channels set to pure white (1.0, 1.0, 1.0). Pixels at or below the threshold are left alone. Any alpha channel survives the process.
The one control that matters:
threshold(INT, 0–255, default 240) - the brightness line. The default of 240 is deliberately conservative: it only catches pixels already at 94% brightness or above, so it mostly snaps near-white noise to pure white. Lower it toward, say, 200 and you start flattening visibly light-gray content too - including light details on your subject.
Input is images (IMAGE); output is a single IMAGE tensor, same size, with the bright pixels whitened.
Where it fits
It's the cleanup pass, not the main event. In a document workflow it's the final step that makes a scan of text look crisp and flat instead of paper-toned. In a product or sprite pipeline it polishes a white-backdrop render before compositing. Because it only touches the brightest pixels, it's also safe to run on batches where the noise level varies - the per-pixel test means nothing about one frame influences another.
Honest limitations
It has no notion of "noise" as a concept - no connectivity check, no median filtering, no blob removal. A bright pixel inside the subject gets whitened just as eagerly as one in the background. Gray stains darker than the threshold survive completely, because the operation only moves pixels toward white, never darkens anything. And the threshold applies to per-pixel brightness, so a gradient that dips below the cutoff will show a hard seam where the flattening stops. If your "noise" is structural - smudges, shadows, halos - this node won't fix it; that needs a real background-removal model (BiRefNet is the usual recommendation). This is a floor-cleaner, not a re-painter.
Installing
Same pack as all the others:
cd ComfyUI/custom_nodes
git clone https://github.com/keit0728/ComfyUI-Image-Toolkit
Restart ComfyUI or install "ComfyUI-Image-Toolkit" via ComfyUI Manager. The only dependency is opencv-python==4.11.0.86 (pinned, so pip may shuffle an existing OpenCV). No models, no GPU, CPU-only, batch-safe.
Gotchas
Default threshold of 240 means this does very little until you move it - if you try it and see no change, that's expected at the default on most images; that's the conservative setting working as designed. And the usual pack notes: tiny anonymous project (Japanese author, last touched mid-2025), README clone URL is a placeholder (your-username) while the real repo is keit0728/ComfyUI-Image-Toolkit. Simple node, works, and nobody will answer your support questions - but you can read its ~60 lines of source in a minute.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | Images to process. | |
| threshold | INT | 2400–255 | Threshold value for binarization (0-255) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |