LC Smart Detailer 🩹
Type \"Hands\" and It Repaints Them
- image
- model
- vae
- positive
- inpaint_positive
- negative
- image
- mask
Every detailer does the same four things: find the region, crop and upscale it, re-render, paste it back. The Impact Pack made that loop standard with SEGS - detectors emit segments, DetailerForEach iterates them, SEGSPaste composites - and if you enjoy wiring six nodes to fix one face, more power to you. This node collapses the loop into one box and replaces the trained YOLO detector with a text prompt. You type hands, face and it finds them, redraws each at about a megapixel, and blends them back.
The case it's built for is the one nothing else does well: an otherwise-good image where the small things are mangled, because a 70px face in a 1024px frame has no latent budget to spend. That's the detail pass people have run since ADetailer; the complaint in the ComfyUI world has always been the ergonomics, and this is a direct answer to it.
How it works
Detection is Meta's SAM 3 through ComfyUI's own built-in SAM 3 support. Each word in prompt is a separate detection, comma separated, and the node asks for up to 16 objects per word - which matters, because ComfyUI's SAM 3 node otherwise returns one detection per prompt and "hands" would find exactly one hand. threshold is how sure the model has to be; 0.5 is a sane start.
After that, the parts that make the paste invisible. Each object's mask is grown by grow pixels, objects whose crops end up overlapping are merged and done together, and padding adds surrounding pixels so the model can see the context. Each crop is resized to about inpaint_resolution squared - sized by area, not by long side, so a wide crop keeps as much detail as a square one - then sampled as a masked inpaint over a ring wider than the pasted area, so the seam lands on pixels the model already blended. The redraw's colour is then matched to the original along that ring, and finally pasted with a feathered edge scaled by blend. The code comment is blunt about why there's no "crop out to half the object's size" option: at 4x upscales that leaves blotches. Padding alone keeps the object large in the crop.
Nothing found? The image passes through untouched and the node says so, rather than hallucinating something into an empty mask. There's also a before/after wipe on the node with the found areas outlined, which is the fastest way to see what your prompt actually matched.
The inputs you'll actually touch
image, model, vae, and positive - the image's own prompt, because the crop is redrawn with the same conditioning unless you override it. Then prompt for what to detail (hands is the default; face:1 caps a word at one match) and threshold.
The tuning dials: grow 4, feather 8, blend 0.8 - blend is how much redraw gets pasted, and dropping it to 0.6-0.7 is the fix for a redraw that went too far. denoise 0.3 keeps the shape and fixes detail. cfg is 1 for Flux, Krea 2, Anima and other cfg-1 models, around 5-7 for SDXL, and the node refuses to go below 1 - a lower value from a pipe or a wire is raised, because below 1 the redraw comes out speckled. steps 20, sampler and scheduler as usual, seed for the redraw.
The optional inputs are the ones that separate "works" from "why is there a tiny scene inside my face shot": inpaint_positive (a short prompt for the crops only, like "close-up of a woman's face, natural skin") and negative (leave it empty for cfg-1 models, wire it for SDXL).
Outputs are image and mask - the mask being where the redraw landed, which you'd feed into a composite or a second pass.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/lonecatone23/ComfyUI_LC_MaskMaker_nodes
# restart ComfyUI
Manager: search "LC MaskMaker" (ComfyUI_LC_MaskMaker_nodes, v0.17.1, MIT). The installer ensures transformers and huggingface_hub are present. You need a ComfyUI new enough to have built-in SAM 3 - the node will tell you loudly if yours isn't. The sam3_model dropdown offers the SAM 3.1 download (1.7GB, sam3.1_multiplex_fp16.safetensors from Comfy-Org/sam3.1, saved to models/sam3), and your own sam3.pt / sam3.safetensors in models/sam3 works too - the pack drops a text projection those checkpoints carry that ComfyUI can't load, which is exactly why the stock file sometimes fails to load elsewhere. Meta's own facebook/sam3 is gated behind manual approval and is never downloaded for you.
Where people get burned
The clone problem. Every region is re-rendered on the same seed, so a crowd of separate faces converges on the same person. This is an old ADetailer failure and it still applies: vary the seed per region, prompt for distinct faces, or do crowds by hand.
Over-processing. If the face is already large and sharp, a second pass changes it without improving it. Detail at native resolution before you upscale, and turn the node off for anything that wasn't broken.
The prompt leaking into the crops. At denoise 0.3 and above, a positive that describes the whole scene can get drawn into every crop. Wire inpaint_positive if that's happening.
Colours are a hint, not a filter. "Red dress" can still pick a green dress, and things that aren't in the image aren't found at all. Drop threshold below ~0.35 and it starts inventing matches for words that aren't there.
Inputs (21)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| model | MODEL | — | |
| vae | VAE | — | |
| positive | CONDITIONING | The image's prompt. A prompt describing the whole scene can get drawn into every crop at denoise 0.3 and up (a whole tiny scene in the face): wire inpaint_positive to prevent that. | |
| prompt | STRING | Face | What to detail, as simple words separated by commas: hands, face. Every match is found (both hands, every face). Add :N to cap it, e.g. face:1. |
| sam3_model | COMBO | SAM 3 model that does the finding. Pick the SAM 3.1 download, or use your own sam3.pt / sam3.safetensors in models/sam3. | |
| threshold | FLOAT | 0.500.05–0.95 | How sure SAM 3 has to be. Lower finds more (and more wrong things), higher is pickier. 0.5 is a good start. Colors are only a hint: 'red dress' can still pick a green dress. Things that are not there are not found. |
| grow | FLOAT | 4.0-64–256 | Pixels to grow (positive) or shrink (negative) the mask before inpainting. Growing a little covers the edges. |
| feather | FLOAT | 8.00–128 | Softness of the mask edge in pixels, so the redrawn area blends into the rest. 0 = hard edge. |
| blend | FLOAT | 0.800–1 | How much of the redraw is pasted in: 1 = all of it. Below 1 the old and new pixels are mixed, and features the redraw moved a little (lashes, eyelids) can show twice. For a lighter redraw, lower denoise instead. |
| padding | INT | 640–1024 | Pixels of the surrounding image included with each crop, so the model sees the context. |
| inpaint_resolution | INT | 1024256–4096 | Each crop is redrawn at about this many pixels squared (1024 = 1 megapixel), whatever its shape. Higher = more detail, slower. |
| sampler_name | COMBO | Sampler. | |
| scheduler | COMBO | Scheduler. | |
| steps | INT | 201–150 | Sampling steps. |
| cfg | FLOAT | 1.01–30 | CFG for the redraw. 1 works for Krea 2, Flux, Z-Image, Anima and, at detailer denoise (up to about 0.4), SDXL too (tested: SDXL looked the same at cfg 1 to 7). Never goes below 1: below 1 the redraw comes out speckled. |
| denoise | FLOAT | 0.300–1 | How much is redrawn. Low keeps the shape and fixes details, high redraws from scratch. |
| seed | INT | 00–18446744073709550000 | Seed for the redraw. |
| inpaint_positiveopt | CONDITIONING | Optional. A prompt for the crops only, e.g. 'close-up of a woman's face, natural skin'. Used instead of positive for the redraw. Recommended whenever positive describes the whole scene. | |
| negativeopt | CONDITIONING | Optional. Leave empty for cfg 1 models; wire it for SDXL and other models that use a negative. | |
| tone_matchopt | BOOLEAN | true | On: the redraw gets the original's brightness, contrast and colour back where it is pasted, keeping the new detail. A light redraw comes back a little flat and dull without it. Turn off when the redraw is meant to change colours (a new shirt colour, a different object). |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |