Background Removal, Upscaling, img2img and Inpainting in ComfyUI: Four Workflows That Run Locally for Free

This page contains advertising (affiliate links). See our Privacy Policy for details.

I run AI image work on a desktop with an RTX 3090. Two jobs come up constantly: background removal (cutting the subject out of a photo and making the background transparent) and upscaling (enlarging an image to a higher resolution). Cloud services charge roughly $8 to $55 a month for this. Locally, the cost is $0 and there is no cap on how many images you process.

Everything in this article runs on ComfyUI (a free tool where you build image pipelines by connecting nodes) and a GPU with 8GB of VRAM or more. VRAM is the dedicated memory a graphics card uses for its own work.

This article walks through four local workflows — background removal, upscaling, img2img, and inpainting — with the node layout for each. Tested on an RTX 3090 (24GB VRAM) with ComfyUI on Python 3.12.3.

Content as of July 2026.

Cloud services versus running it yourself

Here is what the common cloud options cost per month.

Service What it does Monthly Cap
remove.bg Background removal from about $9 (Lite: 40 images/mo) Depends on plan
Topaz Labs Studio Upscaling, denoising from about $35 (annual billing) 300 cloud credits/mo (desktop unlimited)
Adobe Firefly Standard Generation and editing about $10 2,000 credits/mo

remove.bg is dedicated to background removal, and its free tier only outputs low resolution (0.25MP); HD output requires buying credits. Topaz Labs moved to subscription-only in 2025 and discontinued its perpetual licence. Adobe Firefly is mainly a generation tool but also handles removal and upscaling.

Cloud services are convenient, but you pay every month, you hit caps, and your images leave your machine. A GPU costs money once, and it is useful for generation and everything else besides.

Sponsored

Background removal: how the AI approaches differ

Cutting a subject out of a photo is the single most requested job here, whether for product shots or collage material.

AI background removal splits into three families.

Approach Typical models Character
Segmentation (U-Net family) RMBG-1.4, IS-Net Classifies every pixel as foreground or background. Fast and accurate
Matting (trimap family) GFM, MODNet Strong on semi-transparent areas such as hair and glass. Sometimes needs a trimap prepared first
Zero-shot (SAM family) SAM2, Grounded-SAM You point at what you want with a prompt or coordinates. Very flexible

ComfyUI gives easy access to RMBG from the first family and SAM2 from the third. In practice RMBG handles almost everything.

Option 1: RMBG (start here)

RMBG is BRIA AI’s background removal model. One click and the background is transparent. It is a U-Net segmentation model, accurate enough that fine detail such as hair comes out cleanly.

Compared with remove.bg’s free tier, which is limited to low resolution, RMBG outputs at full resolution. Quality is on par with remove.bg’s paid tier.

One caveat: BRIA’s RMBG model is licensed for non-commercial use only. If you are cutting out product photos for a shop, either arrange a licence with BRIA or look at an alternative such as BiRefNet, which has an MIT-licensed version.

Custom node needed:

  • ComfyUI-BRIA-RMBG (installable from ComfyUI Manager)

Model:

  • RMBG-1.4 (official BRIA AI release, about 176MB)

Node layout:

WORKFLOW
Background removal (RMBG)
LoadImage
RMBG Background Remove
SaveImage
Steps:
1. Search ComfyUI Manager for “BRIA RMBG" and install it
2. Restart ComfyUI
3. Load your image with a LoadImage node
4. Add an RMBG Background Remove node and connect it
5. Add a SaveImage node for the output
6. Run (Queue Prompt)

You connect LoadImage straight into RMBG Background Remove. There is almost nothing to configure, and the model downloads itself on the first run.

Option 2: SAM2 (when you need to pick the subject)

SAM2 (Segment Anything Model 2) is Meta’s zero-shot segmentation model. You specify what to cut out using coordinates or a prompt, which gives you fine control — “just the person", “just the product".

Where RMBG automatically finds the foreground of the whole image, SAM2 lets you say which object you mean. That matters when a photo has several subjects and you only want one of them.

Custom node needed:

  • ComfyUI-SAM2 (installable from ComfyUI Manager)

Model:

  • sam2_hiera_large.pt (about 900MB)

Node layout:

WORKFLOW
SAM2 segmentation
LoadImage
SAM2 Segmentation
MaskToImage
SaveImage
SAM2ModelLoader feeds the segmentation node; the original LoadImage also feeds ImageComposite
Steps:
1. Search ComfyUI Manager for “SAM2" and install it
2. Put the model file in ComfyUI/models/sam2/
3. Load the model with SAM2ModelLoader
4. Point the SAM2 Segmentation node at your target with coordinates or a prompt
5. Use the resulting mask to make the background transparent

Try RMBG first. Reach for SAM2 when you need to isolate one subject among several, or select a specific region.

Upscaling: which model for which image

Enlarging a low-resolution image is a standard finishing step after generation.

Approach Typical models Character
Real-ESRGAN family RealESRGAN_x4plus, 4x-UltraSharp GAN-based. Sharp, crisp output. Fast
SwinIR SwinIR-L Transformer-based. Good at denoising, natural results. Slower
Diffusion-based StableSR, SUPIR Stable Diffusion based. High quality, but heavy on VRAM and slow

For everyday use, 4x-UltraSharp from the Real-ESRGAN family strikes the best balance of speed, quality and VRAM. Against Topaz Gigapixel AI (from about $35/month), it holds up well on illustration and anime-style images. For photographs, RealESRGAN_x4plus is perfectly usable.

Picking a model

Model Scale Character Best for
4x-UltraSharp 4x Sharpness-forward, crisp detail Illustration, anime style
RealESRGAN_x4plus 4x Balanced, works on photos and art General purpose
RealESRGAN_x4plus_anime_6B 4x Tuned for anime and illustration Anime style only
RealESRGAN_x2plus 2x Two-times scale, faster When a modest enlargement is enough

For anime-style images from Animagine-XL-3.1, 4x-UltraSharp is a good match. For photo-based images, RealESRGAN_x4plus is the steadier choice.

Models go in ComfyUI/models/upscale_models/.

Node layout

WORKFLOW
Upscaling (basic)
LoadImage
ImageUpscaleWithModel
SaveImage
UpscaleModelLoader supplies the model to ImageUpscaleWithModel
Steps:
1. Put the upscale model (.pth file) in ComfyUI/models/upscale_models/
2. Select it in an UpscaleModelLoader node
3. Feed your image into ImageUpscaleWithModel
4. Run

A 512×512 image at 4x becomes 2048×2048. An SDXL output at 1024×1024 becomes 4096×4096. An RTX 3090 handles 4096×4096 without complaint.

If you run out of VRAM

On an 8GB card, upscaling a large image can fail for lack of VRAM. Tiled processing is the way around it: the image is split into tiles, each tile is upscaled, and the results are stitched back together. Peak VRAM then depends on tile size rather than the full image.

Sponsored

img2img: restyling an image you already have

img2img feeds an existing image into the model together with a prompt, and the model redraws it. How far it strays from the original is controlled by the denoise setting.

denoise What you get
0.2 – 0.4 Composition intact, texture and finish change
0.5 – 0.7 Composition roughly kept, style clearly changes
0.8 – 1.0 Close to generating from scratch; the original barely survives
WORKFLOW
img2img (SDXL)
LoadImage
VAEEncode
KSampler
VAEDecode
SaveImage
The checkpoint loader and both CLIP text encoders feed the KSampler

The key difference from generating from scratch is that the latent comes from VAEEncode on your image, rather than from an empty latent.

Inpainting: fixing part of an image

Inpainting masks a region and regenerates only that area. It is what you want for removing an unwanted object, or redrawing a hand that came out wrong.

WORKFLOW
Inpainting
LoadImage (+mask)
VAEEncodeForInpaint
KSampler
VAEDecode
SaveImage

The mask editor is built in

You do not need a separate image editor. Right-click a LoadImage node, choose “Open in MaskEditor", paint over the area you want redrawn, and save. The mask travels with the image to VAEEncodeForInpaint.

Painting slightly beyond the edge of the object usually blends better than tracing it exactly.

Sponsored

Roughly how long each job takes

Measured on an RTX 3090 (24GB VRAM). Treat these as ballpark figures — they move with image size and settings.

Job Time per image
Background removal (RMBG) A few seconds
Upscaling 4x (1024 to 4096) Tens of seconds
img2img (SDXL) Comparable to generating from scratch
Inpainting Depends on the masked area; usually shorter than a full generation

Background removal is fast enough that batching a hundred images is not a chore. This is where dropping a subscription starts to feel worthwhile.

Settings by VRAM

VRAM What runs comfortably Notes
8GB Background removal, 2x upscaling, SD 1.5 img2img Use tiled upscaling for large images
12GB All of the above plus SDXL img2img and inpainting A comfortable starting point
16GB and up 4x upscaling at 4096×4096 without tiling Batch work becomes practical
Sponsored

Wrapping up

  • Four jobs — background removal, upscaling, img2img and inpainting — all run locally at no monthly cost
  • Start with RMBG for cut-outs and move to SAM2 when you need to choose the subject
  • For upscaling, 4x-UltraSharp suits illustration and RealESRGAN_x4plus suits photographs
  • 8GB of VRAM is enough to start; 12GB makes SDXL work comfortable
  • Check the licence before commercial use — BRIA’s RMBG is non-commercial only

The trade is a one-time GPU purchase against a monthly bill, with the added benefit that your images never leave your machine.

Hardware used

As an Amazon Associate we earn from qualifying purchases.

References

ComfyUI (GitHub)

The tool itself, and the source for node names used above
briaai/RMBG-1.4 (Hugging Face)

Model card and licence terms for the background removal model
Real-ESRGAN (GitHub)

The upscaling models referenced in this article

Checked July 2026. Prices are approximate and converted from the figures published at the time.

Sponsored