Prompt Chain Masked Detail
Hand-paint the region, give it its own prompt, re-render
- model
- vae
- image
- mask
- positive
- negative
- IMAGE
Regional Detailer automates face-finding; this node skips the finding step entirely. Paint a mask over whatever needs fixing - a hand, a prop, a patch of background detail that came out muddy - and Masked Detail crops it, upscales it, resamples it with its own conditioning, and composites the result back in. It's the same detect-crop-refine machinery the pack uses for faces, minus the "detect": you're the detector.
How it works
Wire in an image and a painted mask (from ComfyUI's MaskEditor, or anything upstream that produces one), plus a positive/negative conditioning pair - which doesn't have to match your base image's prompt at all. That's the actual point of the node: describe specifically what you want in that region ("detailed human hand, five fingers") rather than relying on the base prompt to have covered it. The masked area gets cropped with context padding, upscaled to a working size, sampled fresh, feathered, and pasted back at full resolution.
The inputs and outputs that matter
model, vae, image, mask, positive, negative are the required plumbing - same shape as a plain KSampler plus a mask. The sampling knobs (seed, steps, cfg, sampler_name, scheduler) work exactly like they do on any sampler.
The fields worth understanding before you touch them: denoise (default 0.5) sets how much of the masked region actually changes - this is a fresh sample, not an edit, so higher values redraw more of it from scratch. guide_size (default 512) is the pixel size the crop gets upscaled to before sampling, and max_size (default 1024) caps how big that upscaled crop is allowed to get, which matters if your mask covers a large area. crop_factor (default 2) is context padding - how much extra room around the mask's bounding box gets included in the crop, so the model has surrounding context rather than sampling in total isolation. feather (default 24px) is the falloff at the edge of the painted shape, and it does double duty: it bounds both what actually gets re-rendered and how the result blends back into the original. grow (default 0) expands the mask outward before sampling even starts, letting the re-render bleed slightly past what you painted - useful if your mask edge is a little tight and you want the fix to fully cover the flaw rather than leaving a sliver of the original problem at the boundary.
Two optional fields, cond_offset_x / cond_offset_y (both default 0), shift the conditioning's coordinate frame - relevant mainly if your positive/negative carry spatially-anchored conditioning from a regional node upstream that needs to line up correctly once it's sampling inside the cropped and upscaled coordinate space rather than the original image. Leave them at 0 unless you have a specific reason to nudge them.
Single IMAGE output - the full image with the masked region replaced.
How to install it
Manager: search ComfyUI-PromptChain. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/mobcat40/ComfyUI-PromptChain.git
Restart and use it anywhere in your graph after you have an image and a mask to fix.
Common issues & troubleshooting
The fix looks disconnected from the rest of the image. Raise crop_factor so the sample has more surrounding context to match tone and lighting against, or raise feather for a softer blend at the seam.
Part of the flaw is still visible at the mask edge. Increase grow a little so the re-render extends past exactly where you painted.
The region got upscaled way beyond what you expected. Check guide_size against max_size - a small mask with a high guide_size can push past max_size on its long side and get clamped, which changes how much detail actually lands.
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| vae | VAE | — | |
| image | IMAGE | — | |
| mask | MASK | The painted region to re-render. | |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| seed | INT | 00–18446744073709550000 | — |
| steps | INT | 201–100 | — |
| cfg | FLOAT | 7.00–30 | — |
| sampler_name | COMBO | 44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38 | |
| scheduler | COMBO | 9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3 | |
| denoise | FLOAT | 0.500–1 | How much of the masked region is re-rendered. |
| guide_size | INT | 51264–2048 | Upscale the crop so the masked region spans about this many pixels while sampling. |
| max_size | INT | 102464–4096 | Cap on the sampled crop's long side. |
| crop_factor | FLOAT | 2.01–8 | Context padding around the mask bbox. |
| feather | INT | 240–128 | Falloff width (px) outside the painted shape — bounds both the re-rendered area and the composite blend. |
| grow | INT | 00–128 | Expand the painted mask outward by this many px before sampling, so the re-render bleeds slightly past the painted edge. |
| cond_offset_xopt | INT | 0-8192–8192 | — |
| cond_offset_yopt | INT | 0-8192–8192 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |