PDtools_Filter_WPNG_v1
Photoshop-threshold for black-background white logos — PDtools_Filter_WPNG_v1
- image
- image
- mask
The cleanest white-on-black logo extractor, and it's just a threshold
PDtools_Filter_WPNG_v1 does one operation and does it well: it takes a black-background, white-content image (white text, white logo, black-and-white line art) and binarizes it - every pixel at or above a threshold becomes white and part of the mask, everything below becomes black. The approach is deliberately "Photoshop Threshold", which the README says outright. You get a hard black/white image and a matching mask, ready to composite or feed into a workflow.
This is the deterministic sibling of the AI matting tools in the KB's background-removal.md. For a clean synthetic asset - a white logo saved on pure black - an AI model is absurd overkill and can actually do worse (it'll "helpfully" interpret the logo as part of the background or invent edges). A threshold can't be fooled, because there's nothing to be fooled by. When you know the asset is black-and-white, this is the right tool, full stop.
How it works
The source is compact and unambiguous. It converts RGB to greyscale (luminance), computes mask = grey >= threshold in float, and builds the output image by repeating that mask into all three channels - so the "white" output is literally the mask turned into an RGB image. Both the black/white image and the mask come out of the same computation, which is why they always agree. Nothing is inferred; it's pixel brightness compared to a number.
That makes threshold the entire game. Lower it (toward 0) and you keep more grey strokes, faint anti-aliasing, and any noise speckle. Raise it (toward 1) and you get a cleaner, punchier result but lose soft edges and faint grey detail. Default is 0.5, which is a sane starting point for most white-on-black assets.
Inputs and outputs
image- the source (white content on black, ideally).threshold- float, 0.0 to 1.0, default 0.5.- Outputs:
image(hard black/white) andmask(same shape, same values). Wireimagefor display or into compositing,maskinto any mask-consuming node - or use the mask as the alpha.
Installing it
Part of Comfyui_PDuse:
cd ComfyUI/custom_nodes
git clone https://github.com/7BEII/Comfyui_PDuse.git
cd Comfyui_PDuse
pip install -r requirements.txt
Or via ComfyUI Manager (search "Comfyui_PDuse") and restart.
The honest limits
It's white content only - if your logo is black on white, this node's default thinking is backwards; invert the image first or you'll key the background instead. The output has no real alpha channel (it's an RGB image plus a separate mask), so "use the mask" is a real step, not a nicety. And because the threshold is global, an asset with uneven lighting - grey-ish white in one corner, pure white in another - will either lose detail or keep noise; there's no local adaptation. But for the flat, clean assets it's aimed at, it's genuinely one of those set-and-forget nodes: plug in, twiddle the slider, done.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| threshold | FLOAT | 0.500–1 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |