Nodes/ComfyUI-PromptChain/Prompt Chain Masked Detail
ComfyUI Node

Prompt Chain Masked Detail

Hand-paint the region, give it its own prompt, re-render

By mobcat40·Created 9 months ago·Updated about a month ago· 15
Prompt Chain Masked Detail
  • model
  • vae
  • image
  • mask
  • positive
  • negative
  • IMAGE
seed0
steps20
cfg7.0
sampler_name
scheduler
denoise0.50
guide_size512
max_size1024
crop_factor2.0
feather24
grow0
cond_offset_x0
cond_offset_y0

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.

Categorypromptchain

Inputs (19)

NameTypeDefaultDescription
modelMODEL
vaeVAE
imageIMAGE
maskMASKThe painted region to re-render.
positiveCONDITIONING
negativeCONDITIONING
seedINT00–18446744073709550000
stepsINT201–100
cfgFLOAT7.00–30
sampler_nameCOMBO44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38
schedulerCOMBO9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3
denoiseFLOAT0.500–1How much of the masked region is re-rendered.
guide_sizeINT51264–2048Upscale the crop so the masked region spans about this many pixels while sampling.
max_sizeINT102464–4096Cap on the sampled crop's long side.
crop_factorFLOAT2.01–8Context padding around the mask bbox.
featherINT240–128Falloff width (px) outside the painted shape — bounds both the re-rendered area and the composite blend.
growINT00–128Expand the painted mask outward by this many px before sampling, so the re-render bleeds slightly past the painted edge.
cond_offset_xoptINT0-8192–8192
cond_offset_yoptINT0-8192–8192

Outputs (1)

NameTypeDescription
IMAGEIMAGE