PDtools_Filter_GodenPNG_v1
Keying gold text and red seals off a checkerboard — a color-key knife, not a magic AI
- image
- image
- mask
For golden logos and red seals, the AI cutout is the wrong tool
PDtools_Filter_GodenPNG_v1 is a deterministic color keyer aimed at one specific, painfully common asset type: gold text, gold logos, and red stamp/seal graphics sitting on a grey, checkerboard, or mosaic background. It finds the gold and red pixels by hue, builds a mask, and outputs both a cleaned image and that mask - so you can composite the emblem onto whatever you're actually working on.
This is worth understanding as a category choice. The KB's background-removal.md covers the AI matting arms race (BiRefNet and friends), and those models are genuinely great at "cut the person out of the photo." But a gold logo on a synthetic checkerboard is a color problem, not a segmentation problem - the AI gets confused by the fake background in ways a hue threshold never will. This node is the sharp knife for that specific cut. You reach for it when the asset is emblem-like and the background is flat and artificial.
How it works
Read the source and it's textbook image processing. It converts to HSV and builds a mask from two hue bands: reds (hue < 12° or > 170°, with saturation and value floors) for seals/stamps, and gold (hue 10°–52°) for the lettering. The mask gets morphological close/open to fill holes and drop specks, then contours are filled (with a minimum area, so noise regions vanish) and a slight Gaussian blur softens the edge so compositing doesn't look crunchy.
The remove_white toggle is the real decision. Set to true (the default), the node also zeros out near-white pixels - which on a grey/checker asset means the white background blocks get deleted cleanly. The tradeoff, stated right in the README: white specular highlights inside the gold lettering get deleted too, so the gold can look slightly flat. Turn it off to keep the white sparkle inside letters, at the cost of possibly not cleaning the background fully.
Inputs and outputs
image- the source.remove_white- boolean, default true. The background-cleanliness vs. highlight-preservation trade.- Outputs:
image(the filtered RGB, gold/red kept, everything else black) andmask(the alpha you actually composite with).
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 search "Comfyui_PDuse" in ComfyUI Manager and restart.
Where it's great and where it isn't
It only keyes red and gold. A blue logo, a white logo, a photo behind the text - none of those are this node's job, and you'll get an empty mask without any error to explain why. The edge is soft but still threshold-shaped; on very small or antialiased gold text you may see fringe, which is what the mask is for (use it for compositing rather than relying on the black-background image alone). And the "threshold" you tune isn't exposed - the hue bands are hardcoded, so your only control is the remove_white switch. If your gold is unusually dark or desaturated, it may not match the hardcoded band at all. For the common "gold logo on checkerboard" case, it's exactly right - a one-click emblem extractor with a sane safety toggle.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| remove_white | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |