Nodes/ComfyUI-FitDit/FitDiT Mask Generator
ComfyUI Node

FitDiT Mask Generator

Your try-on is only as good as this mask, and FitDiT draws it for you

By lgldlk·Created 2 years ago·Updated 2 years ago· 28
FitDiT Mask Generator
  • fitdit_model
  • model_image
  • mask
  • pose_image
  • model_image
category
offset_top0
offset_bottom0
offset_left0
offset_right0

The middle node of the ComfyUI-FitDit pack is the one most people skip straight past, and it's the one that decides whether your virtual try-on looks like a swap or a crime scene. FitDiT can't dress your model until it knows where the current clothes are. Hand-drawing that region is where try-on pipelines fall apart - get the outline wrong by a hair and the garment bleeds into the skin or leaves a floating collar. The FitDiT Mask Generator does the boring-but-critical job of finding the clothes for you, so you can stay out of it.

Why this still matters in the edit-model era

The KB's inpainting essay makes the point well: by 2026 most people migrated to instruction editors like Qwen-Image-Edit or Flux Kontext that swap a garment from a sentence, no mask required. Try-on is the holdout. Those edit models re-emit the whole frame, so the person drifts and pixels you wanted untouched move. A dedicated mask-based pipeline like FitDiT rewrites only the garment region and leaves the rest of the body alone - and that's exactly why it still has a seat at the table.

How it works

The node pulls two preprocessors out of the fitdit_model blob the Model Loader hands you. DWPose finds the body keypoints and renders a pose map. A human-parsing model then segments the photo into clothing-versus-skin. You pick a category - Upper-body, Lower-body, or Dresses - and it crops the clothing mask to that body part. That's the whole trick: the mask isn't hand-drawn, it's computed from the photo itself.

The four offset_* inputs (offset_top, offset_bottom, offset_left, offset_right, each -200 to 200 pixels) grow or shrink that region. This is your manual override, and it's the first thing to reach for when the auto-mask misses the scarf or swallows the jacket seam. Don't re-edit the mask in an image editor - nudge the offsets.

The inputs and outputs that matter

  • model_image - the photo of the person currently wearing clothes. Feed the exact same image you'll use in the Try-On node, or the geometry won't match.
  • category - must reflect what's on the model. Choosing Dresses over a t-shirt-and-jeans shot produces a mask that makes no sense.

Outputs, all three of which wire straight into FitDiT Try-On:

  • mask (MASK) - the region where the garment will be replaced.
  • pose_image (IMAGE) - the DWPose skeleton render that locks your model's body position during generation.
  • model_image (IMAGE) - a passthrough of the input.

Install

This node ships with the pack, so you're installing ComfyUI-FitDit, not it alone: ComfyUI Manager → search "FitDiT", or cd ComfyUI/custom_nodes && git clone https://github.com/lgldlk/ComfyUI-FitDit, then restart. The heavy lifting - the FitDiT weights themselves - is a separate, gated download on Hugging Face that you must request access to before anything runs.

When it goes wrong

Two failure modes are worth knowing before you hit them. First, DWpose and the human parser run through onnxruntime, which ComfyUI does not install for you and this repo doesn't declare either (there's no requirements.txt). If the node fails to import, pip install onnxruntime opencv-python into ComfyUI's venv is the usual fix. Second, the pack's TODO literally says "custom mask optimization" - meaning you can't drop in your own mask yet; it always computes one, and offsets are your only control. If the mask is off, that's a category mismatch or an offset problem, not a bug you can route around.

CategoryFitDiT

Inputs (7)

NameTypeDefaultDescription
fitdit_modelFITDIT_MODEL
model_imageIMAGE
categoryCOMBO3 options: Upper-body, Lower-body, Dresses
offset_topINT0-200–200
offset_bottomINT0-200–200
offset_leftINT0-200–200
offset_rightINT0-200–200

Outputs (3)

NameTypeDescription
maskMASK
pose_imageIMAGE
model_imageIMAGE