Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > lf-nodes > Background Remover

ComfyUI Node: Background Remover

Class Name

LF_BackgroundRemover

Category
✨ LF Nodes/Filters
Author
lucafoscili (Account age: 2675days)
Extension
lf-nodes
Latest Updated
2026-02-17
Github Stars
0.03K

How to Install lf-nodes

Install this extension via the ComfyUI Manager by searching for lf-nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter lf-nodes in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Background Remover Description

Removes image backgrounds with selectable models, producing transparent or colored images and masks.

Background Remover:

LF_BackgroundRemover separates the main subject of an image from its background using a selectable background-removal model. You can use it to prepare subjects for compositing, make transparent assets, or place a subject against a solid color. It can process more than one image in a run and provides both the finished images and the cutouts and masks used to make them, so you can inspect the separation or refine the result elsewhere in your workflow. A comparison view also helps you assess the original image against the processed result.

Background Remover Input Parameters:

image

The image or images you want to process. This required IMAGE input accepts an image tensor or a list of image tensors, and the node processes each image in turn. The quality of the separation depends on the image and the selected model. No minimum, maximum, or default number of images is specified, but at least one image must be supplied.

transparent_background

Controls how the finished image treats the removed background. When true, the background stays transparent, which is useful when you intend to place the subject over another image later. When false, the removed area is filled with background_color instead. This required BOOLEAN input defaults to true; its options are true and false.

background_color

The hex color used to fill the removed background when transparent_background is false. For example, #FFFFFF requests white. This required STRING input defaults to #000000 (black). The node source specifies no length limit or complete list of accepted colors. When transparency is enabled, this setting does not determine the visible background of the finished image.

model

Selects the model used to identify the subject and background. Different models may suit different kinds of artwork, so comparing results can help you choose one for your image. This required input defaults to u2net. Its available options are u2net, u2netp, u2net_human_seg, silueta, isnet-general-use, isnet-anime, and RMBG-2.0. The source specifically notes that RMBG-2.0 uses a trusted local model package in models/RMBG/RMBG-2.0 and is not downloaded automatically.

ui_widget

An optional LF_COMPARE input associated with the node’s comparison interface. Its default is an empty object, {}. The execution code does not read this input to make the background-removal result, so changing it is not shown to alter the processed images or masks. No minimum or maximum is specified.

Background Remover Output Parameters:

image

The primary processed IMAGE output, with the background removed. Depending on transparent_background, the removed area is transparent or filled with the chosen color. The node selects the first normalized image batch when one is available, or the first processed image otherwise. Use this socket when you want the main finished-image result.

image_list

A list of processed IMAGE results, one corresponding to each input image. These are the finished images with the background treated according to your transparency and color settings. Use this output when you want to keep the per-image results separate for later steps.

cutout_list

A list of cutout IMAGE results, one for each processed image. A cutout represents the separated subject independently of the finished image’s chosen background treatment. This is useful when you want to work with the extracted subject in a later compositing step.

mask

The primary MASK result used for background removal. A mask describes the separation between the subject and the removed background and can be passed to later steps that accept masks. The node selects the first normalized mask batch when one is available, or the first mask otherwise; the source does not specify the mask’s pixel-value convention.

mask_list

A list of MASK results corresponding to the processed images. Use these when you need each image’s separation mask individually, such as for further editing or effects applied image by image. The source does not specify a particular white-versus-black interpretation for these masks.

stats

A JSON object containing a runs array. Each entry contains any statistics supplied by the background-removal effect for one image, plus an index indicating that image’s zero-based processing position. The available statistic fields are not defined in this node’s source, so inspect the returned object rather than relying on particular metrics being present.

cutout

An IMAGE batch of cutouts, provided as the final socket to preserve the positions of the other outputs. Unlike cutout_list, this is the first normalized cutout batch. Use it when a later node expects a batched IMAGE input; use cutout_list when you need the individual cutout results.

Background Remover Usage Tips:

  • Leave transparent_background enabled when preparing a subject to place over a new scene. Disable it and set background_color to a hex color, such as #FFFFFF, when you need a finished image on a solid background.
  • Start with the default u2net model, then compare results with other available models if the subject’s edges or fine details are not separated as you need. u2net_human_seg and isnet-anime are named options you can test for human subjects and anime-style imagery, respectively; the best result still depends on the specific image.
  • Before selecting RMBG-2.0, ensure its trusted local package is available at models/RMBG/RMBG-2.0. This node does not automatically download it.
  • Use the comparison interface to check the processed image against the original. If you need to refine the separation downstream, retain mask_list alongside image_list so the corresponding results remain available.
  • When processing multiple images, use the list outputs to access each result separately. The index in each stats.runs entry identifies its position in processing order, starting at 0.

Background Remover Common Errors and Solutions:

No images provided for background removal.

  • Explanation: The node found no images after normalizing the image input, so it has nothing to process.
  • Solution: Connect an IMAGE-producing node and confirm it supplies at least one image when the workflow runs.

Background remover filter response missing required tensors.

  • Explanation: The background-removal effect returned without a required cutout or mask tensor. The node cannot complete its outputs without both.
  • Solution: Try a different available model and rerun the image. If the error persists, check that the background-removal component and its model files are installed correctly, then report the failing image and model to the extension maintainer.

RMBG-2.0 local model package unavailable

  • Explanation: This is a possible model-loading failure, not an exact error string defined by the node class. RMBG-2.0 expects a trusted local package at models/RMBG/RMBG-2.0 and does not download it automatically.
  • Solution: Install the required trusted package in that location according to the extension’s setup instructions, or select another available model.

Invalid or unusable background color

  • Explanation: This is a possible color-processing failure, not an exact error string defined by the node class. The background-removal effect may be unable to use a color string that does not match the expected hex-color format when transparency is disabled.
  • Solution: Set background_color to a hex value such as #000000 or #FFFFFF, then rerun the node.

Background Remover Related Nodes

Go back to the extension to check out more related nodes.
lf-nodes
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

Background Remover