Nodes/comfyui-magic-hour/Magic Hour: Body Swap
ComfyUI Node

Magic Hour: Body Swap

Magic Hour: Body Swap

By magichourhq·Created about 17 hours ago·Updated about 16 hours ago· 0
Magic Hour: Body Swap
  • person
  • scene
  • image
  • image_paths
  • credits_charged
◄resolution640px►

This is the honest version of the "put me on a beach in Bali" trick. Two photos in - one person, one scene - and one photo out, where the person appears in the scene with plausible lighting. No mask to draw, no ControlNet stack, no relighting pass.

Where it sits in the ecosystem

Locally you can get most of the way to this with an identity-preserving pipeline: IP-Adapter or PuLID to hold the face, IC-Light or a relight pass to fix the lighting, then a composite that you hand-fix in Photoshop because the seam is always visible somewhere. The KB's identity doc covers why that's fiddly - the reference-image weight that keeps the face consistent also flattens detail, so you're always trading likeness against fidelity.

Body Swap skips that entirely. It's a hosted model, so what you're buying is the part that's genuinely hard locally: making the person smell like they belong in the new lighting.

How it works

The two images are converted to temp PNGs and uploaded as person and scene. The remote tool segments the person, places them in the scene, matches light direction and colour temperature, and returns a single composited image. The node downloads it into ComfyUI/output/magic_hour/ and hands it back.

Like every node in this pack, only the first image of a batch is used per input. Pass a batch of five faces and you get one result for frame zero - if you want five swaps, you're queuing five runs (and paying for five).

Inputs and outputs

Required:

  • person - the body/subject photo. Full or three-quarter body works best; the tool needs to know what shape it's placing. A headshot alone leaves a lot for it to invent.
  • scene - the environment. Landscape-ish framing, visible ground plane, and consistent lighting within the scene itself. Two sunsets fighting each other produces mud.
  • resolution - 640px (default), 1k, 2k, 4k. This is the dial that governs both quality and cost, and it moves fast. Start at 640px to check the pose and placement are sane, then re-run at 1k or 2k once you're happy. Going straight to 4k on a first attempt is how people burn a day's credits on an image where the feet don't match the ground.

Outputs: image (the IMAGE result, wire into Preview/Save Image or a further upscale), image_paths (STRING with the saved file - one path per returned file, newline-joined), credits_charged (INT, what that specific run cost).

Install

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

Restart ComfyUI afterwards; nodes appear under Magic Hour. The only install-time dependency is magic-hour>=0.87.1 - the SDK - since the model runs on their servers. Manager users can search "Magic Hour".

Key, outside the workflow:

export MAGIC_HOUR_API_KEY=your_key_here

or a bare api_key.txt inside the pack folder. The author's reasoning is sound and worth repeating: node widget values are saved in the workflow JSON, so a key in a field leaks the moment you share the graph on Discord.

What goes wrong

Feet and ground contact. The classic failure. The person is placed, lit, and still floating a centimetre off the pavement because nothing in the pipeline knows about contact shadows. Choose scenes where the subject stands on something unambiguous.

Faces drifting. This is a body swap, not an identity lock. If the face must survive exactly, swap it back afterwards or run it through a dedicated face node - see this pack's Head Swap for the same problem in a different shape.

422 on a combination. Some resolution and aspect combinations aren't supported. Drop a tier and retry; the node surfaces Magic Hour's own error text.

The long pause. Image jobs are usually faster than the video ones here, but they still wait synchronously and hold your queue.

Consent and terms. The node's own description says it: only use photos you have the right to use. Synthesising a specific person into a specific place is the exact use case that gets tools and accounts in trouble, and it's not a technicality.

If you're doing this at volume, the more interesting pattern is to use this node once to generate a strong reference, then feed that into a local IP-Adapter or LoRA workflow so subsequent frames cost nothing. One paid call, then free local iterations.

CategoryMagic Hour

Inputs (3)

NameTypeDefaultDescription
personIMAGE—
sceneIMAGE—
resolutionCOMBO640px4 options: 640px, 1k, 2k, 4k

Outputs (3)

NameTypeDescription
imageIMAGE—
image_pathsSTRING—
credits_chargedINT—