Cut PNG (Background Remove)
One-node cutouts, but the defaults will bite you
- image
- IMAGE
CutPNGNode is a one-node cutout machine: feed it an image, it strips the background with BRIA's RMBG v1.4 model and hands you back a transparent PNG - and it also crops the result while it's at it. If you've ever built a product-shot or compositing workflow out of four different nodes that all silently drop your alpha channel, the appeal is obvious. One IMAGE in, one IMAGE out, transparency intact.
Before you get excited: this is a small, personal pack (one commit, written for the author's own Windows portable install), and the defaults are set up for their machine, not yours. It works, and it's genuinely simple, but you'll hit both traps below within your first two runs.
How it works
The node loads a TorchScript checkpoint (RMBG-1.4.pt) with torch.jit.load and runs it on CPU. It converts your ComfyUI image tensor to a PIL image, resizes it down to 320×320 for inference, runs the model, then thresholds the output at 0.5 to make a hard black-and-white mask and stretches it back up to your original size. That mask gets applied to an RGBA copy of the image, and the whole thing is cropped to your box before being returned as an IMAGE tensor.
Two things about that mechanism matter for quality. First, the model runs on CPU, always - fine for one image, but don't feed it a batch (there's no batch support; it squeezes to a single frame). Second, and more importantly, that 320×320 inference step is a real downgrade. RMBG-1.4 is designed for ~1024×1024 input, so on a big generated image you're asking the model to find edges it can't actually see. Combined with the hard 0.5 threshold (no soft matte), you get the classic problem the whole background-removal scene keeps fighting: fine hair and semi-transparent edges come out blocky. It's acceptable for product shots on clean backgrounds - exactly what the community said about RMBG-1.4 back in 2024 - and it's not the node you want for flyaway hair.
The inputs that matter
- image - any IMAGE. No mask, no prompt, nothing clever; it's a full-frame subject cut.
- model_path - the gotcha. The default is a hardcoded
E:\ComfyUI_windows_portable\...path from the author's machine, so it will not exist on yours. Point this at wherever you savedRMBG-1.4.pt. The node caches the loaded model, so you only pay the load cost once. - x, y, width, height - the crop box. And here's trap number two: the defaults crop a 256×256 box from the top-left corner. Run it without changing these and you'll get a tiny transparent sliver of your subject's forehead. Set
widthandheightto your image's actual dimensions (or whatever crop you want) before you hit queue.
The single output is an IMAGE carrying an alpha channel - that's the point of the node. Save it with a regular Save Image node as PNG and you keep the transparency.
Install
ComfyUI Manager is the easy route - search for "ComfyUI-Pathway-CutPNG-Node". Or clone it manually:
cd ComfyUI/custom_nodes
git clone https://github.com/pathway8-sudo/ComfyUI-Pathway-CutPNG-Node
then restart ComfyUI. Dependencies are just torch, torchvision, numpy, pillow and huggingface_hub - all things you already have in any ComfyUI install, so no heavy pulls.
The one thing the repo does not give you is the model. There's no download script and no bundled weights, so grab RMBG-1.4.pt from BRIA's RMBG-1.4 release yourself, drop it anywhere sensible, and set model_path to it. Note it's a non-commercial research licence - worth a glance if you're shipping anything.
Troubleshooting
Model not foundimmediately - expected. The default path is the author's Windows portable install; setmodel_pathto your actual file.- Output is a small corner crop - the 256×256 defaults. Set the crop box to the full image.
- Edges look rough - that's the 320×320 downscale plus hard threshold doing what it does. If hair or semi-transparency matters, the KB verdict is to reach for BiRefNet (native in ComfyUI since May 2026) or InSPyReNet instead; this node is for when you want the whole cutout in one box with zero fiddling.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| model_path | STRING | E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\CutPNGNode\RMBG-1.4.pt | — |
| x | INT | 0 | — |
| y | INT | 0 | — |
| width | INT | 256 | — |
| height | INT | 256 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |