Nodes/comfyui-zimage-sdnq/ZImage SDNQ Inpaint Sampler
ComfyUI Node

ZImage SDNQ Inpaint Sampler

Only the masked pixels move

By GeneralShan·Created 8 months ago·Updated 6 months ago· 1
ZImage SDNQ Inpaint Sampler
  • pipeline
  • image
  • mask
  • control_image
  • images
prompt
negative_prompt
steps8
guidance_scale0.0
control_context_scale0.80
seed0
num_images1

ZImageSDNQSamplerInpaint regenerates the masked region of an image and leaves everything outside the mask untouched. It's classical, mask-based inpainting - and in 2026, that specific framing is the entire reason this node still earns its place. Instruction-edit models like Qwen-Image-Edit and Flux 2 Klein will happily "fix the jacket" from a sentence, but they re-render the whole frame and drift accumulates across edits. Masked inpainting's superpower is bit-identical unmasked pixels. If you need one region changed and the rest of the image exactly preserved, this is the tool.

The important architectural detail: this node takes a ZIMAGE_CONTROL_PIPELINE, not the base pipeline. Inpaint on Z-Image is a Fun ControlNet Union mode (added in v2.0 of the union), so you load the control loader, not ZImageSDNQPipelineLoader. If you try to feed it a base pipeline, the type checker will just refuse - that's the pack telling you the wiring is wrong, and it's right.

Inputs

  • image - the source image, which sets the working resolution.
  • mask - the required mask. White = regenerate, black = leave alone, standard ComfyUI convention (LoadImageMask produces this). Feed the mask region a clean white blob and the model fills it.
  • control_context_scale (default 0.8, 0–2) - the strength of the inpainting condition, i.e. how strictly the model respects the unmasked context. This is your blend quality dial. High and the seam can look pasted; low and the model starts wandering into the preserved area. 0.8 is a sensible start; tune in 0.1 steps.
  • control_image (optional) - an alternate control condition fed alongside the mask. If you leave it out, the sampler uses the input image as the context, which is the normal case.
  • prompt / negative_prompt - describe what belongs in the hole. The usual Turbo caveat applies: at guidance_scale 0 the negative is decoration.
  • steps (8) / guidance_scale (0) / seed / num_images - the standard sampler block.

Output: an images tensor at the input resolution, masked region regenerated, rest identical.

Where it fits

The pack's example (zimage_sdnq_inpaint.json) is the canonical graph:

LoadImage → (image) ────────────────────────────┐
LoadImageMask → (mask) ──── ZImageSDNQSamplerInpaint → SaveImage
ZImageSDNQControlPipelineLoader → (pipeline) ───┘

This is the node for surgical fixes - remove an object, swap a face, fix a hand - where you can't afford the rest of the frame drifting. It's also the honest counterweight to the pack's T2I/I2I nodes if you're coming from an edit-model habit: it's slower and more fiddly, and it's the only option that guarantees the unmasked pixels are exactly what you started with.

One practical note from the community's inpainting playbook: don't be afraid to crop the mask region, run this node on the crop, and paste it back - a small mask gets a bigger generation budget that way, and Z-Image's ~2MP ceiling is easier to respect on a crop than on a whole frame.

Install

Same pack install - Manager (search "Z-Image SDNQ") or git clone https://github.com/GeneralShan/comfyui-zimage-sdnq into custom_nodes, restart. Control path deps: pip install sdnq diffusers timm opencv-python-headless. And the control loader's control_config should be 2.0 or newer - v1.0 of the union predates the inpainting mode, so an old weights file simply won't have it.

CategoryZImage SDNQ/Samplers

Inputs (11)

NameTypeDefaultDescription
pipelineZIMAGE_CONTROL_PIPELINE
imageIMAGE
maskMASK
promptSTRING
negative_promptSTRING
stepsINT81–100
guidance_scaleFLOAT0.00–20
control_context_scaleFLOAT0.800–2
seedINT00–18446744073709550000
num_imagesINT11–8
control_imageoptIMAGE

Outputs (1)

NameTypeDescription
imagesIMAGE