ComfyUI Node

Detailer Start

Hand your face to the model at the resolution it deserves

By kinorax·Created 5 months ago·Updated about a month ago· 2
Detailer Start
  • image
  • mask
  • detailer_control
  • inpaint_image
  • inpaint_mask
crop_margin_scale1.50
upscale_factor2.00
mini_unit32
detailer_index0

Detailer Start is the front half of this pack's detailer pair, and it exists because of a dumb arithmetic problem: a face occupying 80×80 pixels of a 1024×1024 frame gets 80×80 worth of model attention and comes out mangled. The fix is to crop that region, give it a proper resolution to itself, fix it in isolation, and paste it back. Start is the crop-and-prepare side of that deal.

How it works

You feed it an image and a mask. Any pixel where the mask is above 0.0 defines the foreground, and Start finds a bounding box around those regions. Then it does three things in order:

  1. Expands the box by crop_margin_scale so the region isn't cropped right up against the subject's edges.
  2. Pre-upscales the crop by upscale_factor, so a small face becomes a big, workable canvas.
  3. Pads the result up to a width and height divisible by mini_unit (8/16/32/64), centered, so you don't hand the sampler an awkward non-multiple-of-8 resolution.

That last step matters more than it looks. Generate outside your model's comfortable multiples and you invite seams, tiling, and the kind of artifacts the troubleshooting guides are full of. The 32 default is a safe, model-friendly choice for SDXL-era sampling.

The original soft mask's graded values are preserved separately and stuffed into detailer_control - that's what lets Detailer End feather the composite later instead of cutting hard edges.

The inputs you'll actually touch

Three knobs dominate:

  • crop_margin_scale (default 1.5) - how much breathing room around the detected region. Too low and the fix has no context to blend against; 1.5 is a solid starting point.
  • upscale_factor (default 2.0) - the resolution headroom you give the crop. 2× is right for faces on a 1024 canvas; go higher for tiny details.
  • mini_unit (default 32) - the alignment unit for the padded crop. Leave it alone unless you know your model wants 8 or 64.

detailer_index is internal bookkeeping for recursive per-item execution - ignore it.

Outputs and the loop

Start gives you three things: detailer_control (wire straight to Detailer End), plus inpaint_image and inpaint_mask. Those last two are the ones you actually route through your inpainting pass - feed inpaint_mask into SetLatentNoiseMask, sample, VAE-decode, and send the result as inpainted_image into End. If Start found no active region at all, End will simply pass the original image through, so an empty mask doesn't crash your workflow.

Installing it

It ships in the ComfyUI-Info-Prompt-Toolkit pack. Easiest via ComfyUI Manager - search "Info Prompt Toolkit". Or:

cd ComfyUI/custom_nodes
git clone https://github.com/kinorax/comfyui-info-prompt-toolkit.git
cd comfyui-info-prompt-toolkit
pip install -r requirements.txt

Restart ComfyUI. No model downloads for this node - those are only for the pack's SAM3 and tagger nodes. It's a small single-author pack (GPL-3.0) rather than a community standard, so the payoff is control and clean metadata wiring, not ecosystem gravity.

CategoryInfo-Prompt-Toolkit/Mask

Inputs (6)

NameTypeDefaultDescription
imageIMAGESource image. Active detailer crops are processed one item at a time between Detailer Start and Detailer End.
maskMASKSoft mask used to determine crop bounds. Any value above 0.0 becomes fully masked in the output inpaint mask.
crop_margin_scaleFLOAT1.501–16Crop expansion multiplier applied directly to the detected mask bounding-box width and height.
upscale_factorFLOAT2.001–16Pre-upscale factor applied to the cropped image and binary inpaint mask before mini-unit padding.
mini_unitCOMBO32Round the output inpaint image and mask size up to a width and height divisible by this unit.
detailer_indexINT0Internal index for recursive per-item detailer execution.

Outputs (3)

NameTypeDescription
detailer_controlIPT-DetailerControl
inpaint_imageIMAGE
inpaint_maskMASK