Nodes/ComfyUI-Leffa/Leffa Virtual Try-On
ComfyUI Node

Leffa Virtual Try-On

Throw a garment at a photo, get a dressed person out

By Bionic-AI-Solutions·Created 2 months ago·Updated 2 months ago· 0
Leffa Virtual Try-On
  • pipe
  • person
  • garment
  • image
  • densepose
  • mask
garment_type
steps30
cfg2.5
seed42
ref_accelerationfalse
repaintfalse
restore_sizetrue

Virtual try-on is one of those things that sounds trivial and isn't. Slap a jacket onto a photo of a person and you have to figure out where the old clothes end, how the new fabric drapes, and how to keep the person's face and hands untouched. This node - Leffa Virtual Try-On from the ComfyUI-Leffa pack - does all of that internally, on your own GPU. You feed it a person and a garment, it hands you the dressed result. No API key, no cloud, no hand-drawn masks.

The reason to reach for this specific node over the alternatives: it runs the entire Leffa pipeline inside ComfyUI. The older StartHua/Comfyui_leffa node only runs the diffusion step and expects you to have pre-computed a DensePose map and an agnostic mask - which is a whole other workflow of pain. Here you just wire images in.

How it works

Leffa is Meta's research model (from the franciszzj/Leffa repo, MIT), and the pipeline it runs is a proper stack. First, a human-parsing model (onnxruntime, on CPU) and OpenPose together work out where the person's clothing is. From that it builds an agnostic mask - it blanks out the garment region while keeping head, hands, and background intact. Next, DensePose maps the person's body surface per-pixel, which is the spatial conditioning that keeps the new garment sitting on the body instead of floating in front of it. Then an SD inpainting model redraws only the masked region, wearing your garment. Everything gets resized to a 768×1024 canvas internally, and the result is scaled back to your original size by default.

The inputs that matter

The required set is small, and only two of them will bite you:

  • pipe - the LEFFA_PIPE from a Leffa Loader set to viton_hd or viton_dc. Use a pose_transfer pipe and the node throws a ValueError.
  • person / garment - plain IMAGE tensors, usually from LoadImage.
  • garment_type - upper_body, lower_body, or dresses. This genuinely matters: it picks the masking strategy, so calling a jacket a dress confuses the whole pipeline.
  • steps (30), cfg (2.5), seed (42) - standard diffusion dials. The defaults are sane; tweak cfg toward 3–4 if garments come out washed out.

Three optional booleans are worth knowing: repaint (default off) composites the original image back in outside the mask, so background and skin stay pixel-identical rather than diffusion-reimagined; ref_acceleration (default off) trades a little reference fidelity for a noticeably faster run; restore_size (default on) returns the output at your source resolution instead of the internal 768×1024.

Outputs

Three of them: image (the tried-on result), densepose (the body-surface map used for conditioning - mostly useful for debugging why something looks off), and mask (the agnostic mask showing exactly what got repainted). Wire image to SaveImage and you're done; the other two are there when you need to see inside the black box.

Installing and running it

Install the pack via ComfyUI Manager (search "ComfyUI-Leffa") or git clone https://github.com/Bionic-AI-Solutions/ComfyUI-Leffa into ComfyUI/custom_nodes, then restart. Then the ~34 GB model download, once, into ComfyUI/models/Leffa:

hf download franciszzj/Leffa --local-dir ComfyUI/models/Leffa

The first run warms everything up and takes a while - that's normal, not a freeze. A typical graph is just LoadImage(person) + LoadImage(garment)LeffaLoaderLeffaTryOnSaveImage.

Where people get burned

Texture. Fabric detail is the honest weakness of every current try-on model - Leffa included - and the community reports the same three failures over and over: tearing at seams, smudging on patterned fabric, and texture loss on folds. A clean, front-facing garment photo with even lighting gets you far; a crumpled shirt photo shot at an angle is where results go mushy. If the output is repainting your background, that's the garment_type mismatch, not a bug. And if it's eating your whole VRAM, remember the pack keeps only one diffusion model resident - switch task on the loader and it'll re-load rather than smoothly swap.

CategoryLeffa

Inputs (10)

NameTypeDefaultDescription
pipeLEFFA_PIPE
personIMAGE
garmentIMAGE
garment_typeCOMBO3 options: upper_body, lower_body, dresses
stepsINT301–100
cfgFLOAT2.50.1–50
seedINT420–2147483647
ref_accelerationoptBOOLEANfalse
repaintoptBOOLEANfalse
restore_sizeoptBOOLEANtrue

Outputs (3)

NameTypeDescription
imageIMAGE
denseposeIMAGE
maskMASK