Nodes/comfyui-magic-hour/Magic Hour: Background Remover
ComfyUI Node

Magic Hour: Background Remover

The cutout is fine. The alpha channel is where this one gets interesting

By magichourhq·Created about 17 hours ago·Updated about 16 hours ago· 0
Magic Hour: Background Remover
  • image
  • background_image
  • image
  • image_paths
  • credits_charged

Background removal is the most commoditised operation in this whole ecosystem. You can do it locally, for free, with BiRefNet - which ComfyUI shipped in core in May 2026 - or with rembg's pile of u2net variants, or InSPyReNet, which the highest-scoring removal thread of 2026 insists is better than any of them. So why would anyone pay an API for it?

Two honest reasons: you're already in this pack and the graph runs on a machine that isn't yours, or you want the subject dropped onto a specific replacement background without building a mask-and-composite chain yourself. That second one is the actual feature here, and it's the reason to read past "just use BiRefNet".

What it does

The node takes your image, uploads it, and gets back a processed version. Required image, optional background_image. If you connect a second image, it's sent along as the replacement backdrop and you get the subject composited onto it. Leave it unwired and you get the cutout.

The output gotcha worth knowing before you start

Everything in this pack that returns images goes through one shared loader, and that loader converts each returned file to RGB. Which means: the PNG saved on disk in ComfyUI/output/magic_hour/ keeps its transparency, but the IMAGE tensor that comes out of the image socket has no alpha channel. The alpha is dropped at the door.

So wiring image straight into a compositor expecting transparency gets you the subject on whatever flat colour the file's background happened to be - usually white or black, and not the result you pictured.

What to do about it:

  • If you want the cutout on something, use the optional background_image input and let Magic Hour composite. That's the intended path and it's why the field exists.
  • If you want the transparent PNG for something outside the graph, read the file path from image_paths and use it there.
  • If you need a mask inside ComfyUI for inpainting or compositing, run a local rembg/BiRefNet node instead. You cannot extract a usable alpha out of the tensor this node hands back.

That's not a bug so much as a mismatch between what "background removed" means to a person and what an RGB batch can carry. Same trap catches people with the GIF node.

Inputs and outputs

| field | what it is | | --- | --- | | image (required) | the source image. Only the first image of a batch is used - batch of four gets you one result | | background_image (optional) | replacement backdrop, sent as the background asset |

Three outputs: image (the IMAGE batch - one frame, or one per returned file), image_paths (a STRING with the saved file path, newline-joined when there are several), and credits_charged (INT, the real cost of that run).

image_paths is the one beginners skip and then need. It's your route to the actual PNG with the alpha still attached.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/magichourhq/comfyui-magic-hour
pip install -r comfyui-magic-hour/requirements.txt

Then restart ComfyUI. Dependencies are just the magic-hour SDK (>=0.87.1) - no weights, no model directory, no GPU. ComfyUI Manager users can search "Magic Hour" instead of cloning.

Key goes in the environment before launch, or in a plain file, never in a widget:

export MAGIC_HOUR_API_KEY=your_key_here
# or: echo 'your_key_here' > comfyui-magic-hour/api_key.txt

Problems you'll actually hit

Hair and fur. The KB is blunt about this: the quality frontier for removal moved years ago from "can it find the subject" to "can it survive hair, fur and semi-transparency", and nobody has won that. Whichever engine you use, flyaway hair and thin structures are where you'll see the seams. Do a test on your worst-case image before commiting a batch.

Batch in, one out. image is a IMAGE socket and people feed it an eight-frame batch expecting eight cutouts. The pack takes the first frame and sends that.

"Card declined" style errors mid-workflow. A 402 means credits or plan tier, and the node shows Magic Hour's message rather than swallowing it. 401 is a bad or deleted key.

You wanted a mask. Covered above - no alpha comes out. This is a compositing node, not a segmentation node.

My read: if your machine can run BiRefNet, run BiRefNet, especially if you need the mask. Reach for this one when the job is "cut this person out and put them on this backdrop" and you don't want to build the composite yourself - or when there's no local GPU in the loop at all.

CategoryMagic Hour

Inputs (2)

NameTypeDefaultDescription
imageIMAGE—
background_imageoptIMAGE—

Outputs (3)

NameTypeDescription
imageIMAGE—
image_pathsSTRING—
credits_chargedINT—