Nodes/TrentNodes/Easiest Green Screen
ComfyUI Node

Easiest Green Screen

The Green Screen You Get Without Buying a Green Screen

By TrentHunter82·Created 9 months ago·Updated 4 days ago· 36
Easiest Green Screen
  • images
  • background_images
  • image
  • mask
bg_colorgreen
model_variantlite
resolutionbalanced (768)
edge_refine2
mask_expand0
temporal_smooth0

The name is doing real work here. Traditional chroma keying means shooting against green, spill cleanup, despill math, a keyer that hates your hair. Easiest Green Screen skips all of it: it runs BiRefNet segmentation to find your subject, then composites the subject over a flat green (or blue, aqua, or white) background. No green screen needed - the green is painted in after the fact, so you can chroma-key anything you already have.

That's the trick worth understanding, because it changes what this node is for. You're not keying a real green screen shot - you're creating a green screen shot from arbitrary footage, so you can hand it to a downstream keyer, or just use the composite directly. It's the classic BiRefNet play (the model that displaced rembg for anything with hair, fur, or fabric edges) wrapped in a one-node convenience, with video batch support on top.

How it works

Feed it images (single image or batch). Inside:

  1. BiRefNet segments the foreground - model_variant chooses lite (faster, less VRAM) or standard (finer edge detail).
  2. resolution (fast 512 / balanced 768 / quality 1024) sets the segmentation processing size. Higher is sharper but heavier - this is the tradeoff that matters most.
  3. The mask gets cleaned: edge_refine feathered the boundary (2–5 is the natural look, 0 is a hard edge), mask_expand grows or shrinks it (positive keeps more subject, negative trims edge fringe).
  4. The foreground is composited over the bg_color - or over background_images if you wire any in, which overrides the color and auto-resizes to match (a single image broadcasts across the whole batch).

For video, temporal_smooth (0–15) averages the mask across neighboring frames to stop the mask from flickering - set 3–7 for subtle stability. That's the difference between a usable clip and a shimmering mess, and it's why this node is genuinely useful for footage, not just stills. Everything runs GPU-accelerated (the segmentation, the morphology, and the torch.lerp compositing).

Outputs: image (background replaced) and mask (white subject / black background) - keep the mask around if you want the alpha for a proper compositor later.

Install

Search "Trent Nodes" in ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/TrentHunter82/TrentNodes.git
cd TrentNodes
pip install -r requirements.txt

This is the one node in the pack's image set with a real model behind it: BiRefNet runs through HuggingFace transformers (a pack requirement), and the weights download on first use. First run will stall for a bit; after that it's cached. Restart ComfyUI after installing. (The author has noted Manager install flakiness on this pack from an early repo rename - manual clone if Manager misbehaves.)

Common issues

  • First run downloads a model. Give it a minute; it's a one-time thing.
  • Fringed or eaten edges. Bump resolution up and feather with edge_refine; if you're losing the subject's edge, lower mask_expand toward the negative.
  • Video mask flickers. That's what temporal_smooth is for - it does nothing on single images, so don't be surprised if stills are unaffected.
  • Quality ceiling. BiRefNet is excellent but not perfect on semi-transparency (glass, veils). For those cases the finer standard variant at quality (1024) is the best this node can do - and that's quite good.

For "give me a clean chroma-keyable version of this footage," this is the one-click answer. The green screen is a lie, and that's exactly why it works.

CategoryTrent/Image

Inputs (8)

NameTypeDefaultDescription
imagesIMAGEInput image or image batch; backgrounds will be replaced with the selected chroma key color
bg_coloroptCOMBOgreenBackground replacement color: green and blue are standard chroma key colors
model_variantoptCOMBOliteBiRefNet model quality: lite is faster, standard gives finer edge detail
resolutionoptCOMBObalanced (768)Processing resolution for segmentation; higher gives sharper mask edges but uses more VRAM
edge_refineoptINT20–20Gaussian feather radius in pixels for soft mask edges; 0 for hard edges, 2-5 for natural blending
mask_expandoptINT0-20–20Grow or shrink the foreground mask boundary in pixels; positive expands foreground (keeps more), negative shrinks it (removes edge fringe)
temporal_smoothoptINT00–15Temporal smoothing window for video batches; reduces mask flickering between frames. 0 = off, 3-7 = subtle, 9-15 = heavy. Has no effect on single images
background_imagesoptIMAGEOptional custom background image or batch; overrides bg_color when connected. Auto-resized to match input dimensions. A single image is broadcast to all frames

Outputs (2)

NameTypeDescription
imageIMAGEImage with background replaced by the selected chroma key color
maskMASKForeground mask from BiRefNet segmentation (white = subject, black = background)