Nodes/ComfyUI Essentials/πŸ”§ RemBG Session
ComfyUI Node Runs on cloud

πŸ”§ RemBG Session

RemBG Session (ComfyUI Essentials)

By cubiqΒ·Created 3 years agoΒ·Updated about a year agoΒ· 1,152
πŸ”§ RemBG Session
    • REMBG_SESSION
    β—„modelβ–Ύβ–Ί
    β—„providersβ–Ύβ–Ί

    Background removal, the lightweight way. RemBG Session sets up a rembg model so you can cut the background out of an image inside ComfyUI. One thing to get straight up front: this node doesn't remove anything by itself - it creates a session (loads a chosen model on a chosen device) that you then feed into the pack's actual background-removal node. It's the "load the model" half of a two-node pair.

    Why you'd reach for it

    rembg is the old-reliable of background removal: MIT-licensed, around since 2020, fast, tiny, and it runs on CPU. It wraps a family of segmentation models behind one simple interface, and it's plenty for solid subjects on contrasting backgrounds - extract a product, cut out a character, isolate a subject for compositing. Splitting it into a "session" node is a small efficiency win: you build the session once and reuse it across many images instead of reloading the model every time.

    Worth setting expectations, though. As of mid-2026 rembg's classic models are the baseline, not the quality frontier. If your subject has flyaway hair, fur, or semi-transparent edges, BiRefNet and InSPyReNet beat these models handily, and ComfyUI actually ships BiRefNet in core now. Reach for RemBG Session when you want something light, CPU-friendly, and good-enough on clean subjects - not when you're fighting a hard edge.

    How it works

    It loads one of rembg's segmentation models onto an execution provider and hands you a session object. model picks which network: u2net (general purpose, the historical default), u2netp (lightweight u2net), u2net_human_seg (tuned for people), u2net_cloth_seg (garment parsing), silueta (a tiny u2net), isnet-general-use (sharper general model), isnet-anime (the one to use on illustration), and sam (Segment Anything). providers is the ONNX Runtime backend - CPU is the safe default; CUDA runs it on your GPU (and needs the GPU build of onnxruntime), with ROCM/DirectML/CoreML and others for various hardware.

    Inputs and outputs

    There are no image inputs here - just the two settings, model and providers. The single output is a REMBG_SESSION, which you wire into the pack's image background-removal node (the one that actually takes an image and returns the cut-out). So the chain is: RemBG Session β†’ background-removal node β†’ your masked/transparent image.

    Installing it

    From ComfyUI Essentials by cubiq (Matteo Spinelli, the IPAdapter node author). ComfyUI Manager: search ComfyUI Essentials, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/cubiq/ComfyUI_essentials
    

    then restart. It's πŸ”§ RemBG Session under essentials/image manipulation, class RemBGSession+. This node needs the rembg and onnxruntime Python packages - the pack's requirements normally install them, and rembg downloads the model weights on first use, so the first run with a new model will pause to fetch it (and needs internet).

    Common issues

    Two things account for most of the trouble. First, dependencies: if the node won't load, rembg or onnxruntime didn't install cleanly - the classic ComfyUI custom-node dependency snag. Reinstall the pack's requirements and check the console. If you picked the CUDA provider but only have plain onnxruntime (not onnxruntime-gpu), it'll fail or silently fall back to CPU. Second, the first run stalls while it downloads the chosen model - that's expected, not a hang; give it a minute. Beyond that, if the cutout is rough around hair or fine edges, that's rembg's known ceiling, not a settings problem - switch to a BiRefNet/InSPyReNet node for hard edges, or use isnet-anime if your subject is an illustration.

    Categoryessentials/image manipulation

    Inputs (2)

    NameTypeDefaultDescription
    modelCOMBO8 options: u2net: general purpose, u2netp: lightweight general purpose, u2net_human_seg: human segmentation, u2net_cloth_seg: cloths Parsing, silueta: very small u2net, isnet-general-use: general purpose, +2
    providersCOMBO8 options: CPU, CUDA, ROCM, DirectML, OpenVINO, CoreML, +2

    Outputs (1)

    NameTypeDescription
    REMBG_SESSIONREMBG_SESSIONβ€”