Nodes/ComfyUI LC MaskMaker Nodes/LC Z-Image AnyPaint 🩹
ComfyUI Node

LC Z-Image AnyPaint 🩹

Z-Image Inpainting, Borrowed From a ControlNet's Inpaint Mode

By lonecatone23·Created about a month ago·Updated about 13 hours ago· 11
LC Z-Image AnyPaint 🩹
  • model
  • clip
  • vae
  • image
  • mask
  • image
  • mask
◄prompt►
◄control(no model patches found)►
◄control_strength1.00►
◄seed0►
◄steps8►
◄sampler_nameeuler►
◄schedulersimple►
◄crop_to_masktrue►
◄padding128►
◄inpaint_resolution1024►
◄boundary_px32►
◄compositekeep original►

Z-Image is fast, small and cheap to run at 8 steps, which makes it a genuinely pleasant thing to fix images with - except there's no inpainting checkpoint for it and no Fill model either. Alibaba's answer wasn't a new checkpoint: the Z-Image Fun ControlNet Union ships an inpaint mode alongside its normal conditioning types, so masked inpainting exists on Z-Image without anybody training a model for it. That's the same trick the 2026 architectures used across the board - a union lands within about a week of each new base these days, and inpaint is one of the modes.

This node drives that inpaint mode properly: crop to the mask, put the kept pixels back every step, let the model blend a border, and composite the result so the rest of your picture is exactly what you gave it.

How it works, and how it differs from the Krea 2 sibling

The mechanics are the shared ones from this pack's Krea 2 AnyPaint node: your picture, white = paint, black = keep; a small mask is redrawn in its own crop scaled up to about inpaint_resolution squared; after every sampling step the kept pixels are forced back on the exact token grid, with boundary_px of border left to the model to blend; then the result is pasted with a soft edge, colour-corrected using the drift measured in the border that was redrawn but not pasted back. Sampling is cfg 1.0, denoise 1.0 with a noise mask.

What changes is the top two widgets and what holds the picture. Instead of a LoRA and a whole-canvas reference shown to the text encoder, you get control - the union patch - and control_strength. Under the hood the patch is loaded through ComfyUI's own ZImageFunControlnet, and inpaint mode hands the model your crop with the painted area greyed out plus the mask. There's also no vlm_reference here, because there's nothing to show it to: Z-Image's text encoder is a Qwen3 4B, not a vision model. The ControlNet is doing the holding instead, which is why control_strength at 1.0 ("as trained") is worth knowing about - it's the one dial that changes how hard the model is pinned to your pixels.

Inputs and outputs

model (Z-Image Turbo or Base), clip (Z-Image's Qwen3 4B encoder), vae, image, mask - the last two arrive on the canvas labelled control_image and control_mask, so LC Outpaint or LC Image Rotate + Pad wire straight in and a mask is optional (with LC Outpaint's canvas, its own mask is used).

prompt describes the whole finished picture, not the change. "Remove the car" leaves a flat blob; "a woman in a red coat on a snowy street" is the kind of sentence that works. control is where you pick the union patch, and control_strength is its weight.

Then the standard set: seed, steps 8, sampler_name euler, scheduler simple, crop_to_mask (on for inpaint, off for outpaint), padding 128 for context, inpaint_resolution 1024 as an area, boundary_px 32, composite at keep original or raw. Outputs are image and mask - the mask being where the redraw was pasted back.

One copy-paste artifact worth flagging before it confuses you: steps and sampler_name carry tooltips that still say "8 (Krea 2 Turbo)" and reference AnyPaint, because this node subclasses the Krea 2 one. Ignore the wording - 8 steps is right for Z-Image Turbo, and euler/simple is the sensible pairing.

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). This one needs a file you must place yourself: Alibaba's Z-Image Fun ControlNet Union goes in ComfyUI/models/model_patches. Get it from alibaba-pai/Z-Image-Turbo-Fun-Controlnet-Union-2.1 - the 8steps one is made for Turbo. Nothing downloads itself here, and the node will refuse with a clear message if control is still showing "(no model patches found)". An uncontroversial tip: Alibaba PAI ships Apache-2.0 weights and generally grades clean on licensing, but the 2.1 union's card is the thing to read, not my summary.

Where people get burned

The inpaint mode is new, and the older union didn't have it. The original Z-Image union ControlNet listed inpainting as a to-do on its model card - people were running Z-Image inpaint workflows with a ControlNet that didn't officially support it and reporting that it "isn't fully supported yet": fine for clothes, hair and colour tweaks, not reliable enough to keep an original face intact. Use the 2.1 patch, and if you're extending canvas, expect the outside to look better than the preserved face does.

That's what keep original is for. The composite is your safety net: set it to raw and you're getting the model's whole redraw of the crop, warts and all. Leave it on unless you're debugging.

Empty prompt, or 0 steps. Both raise explicitly. Zero steps in the error message usually means the wrong output got wired into it.

This isn't the Krea 2 node with a different patch. The Base/Turbo split matters: pick the union build that matches the Z-Image you loaded, and remember Z-Image Turbo is a distilled model - that's why step counts this low work at all, and why you don't have a cfg dial here to fight with.

CategoryLC MaskMaker/inpaint

Inputs (17)

NameTypeDefaultDescription
modelMODELZ-Image (Turbo / Base). The ControlNet patch is added for this node only.
clipCLIPZ-Image's text encoder (Qwen3 4B, CLIP type lumina2).
vaeVAE—
imageIMAGE—
maskMASKWhite = paint, black = keep. Optional: no mask with LC Outpaint's canvas uses its mask. Wire LC Outpaint's control_image as the image and control_mask as the mask to outpaint.
promptSTRINGDescribe the WHOLE finished picture, not just the change: "a woman in a red coat on a snowy street". Removal-only prompts ("remove the car") tend to leave a flat blob.
controlCOMBO(no model patches found)Alibaba's Z-Image Fun ControlNet Union 2.1 (models/model_patches), used in inpaint mode. The 8steps one is made for Z-Image Turbo.
control_strengthFLOAT1.000–2How strongly the ControlNet holds the painting to your picture. 1 = as trained.
seedINT00–18446744073709550000—
stepsINT81–1008 (Krea 2 Turbo). The keep is exact with euler.
sampler_nameCOMBOeulereuler is what AnyPaint was trained and tested with; the keep step is exact only for euler.
schedulerCOMBOsimplesimple, as in the reference.
crop_to_maskBOOLEANtrueOn: a small mask is redrawn in its own crop, scaled up to inpaint_resolution (more detail). Off: the whole picture at inpaint_resolution.
paddingINT1280–2048Context around the mask when cropping (px). More = the model sees more of the scene.
inpaint_resolutionINT1024256–2048Size of the redraw (as an area: 1024 = about 1 MP). AusBoss found above about 1.6 MP Krea 2 starts to crease limbs and darken skies.
boundary_pxINT320–128Border around the mask the model redraws to blend the seam (in redraw pixels). 32 = the reference.
compositeCOMBOkeep originalkeep original = only the painted area (soft edge, colour fixed) is pasted back: everything else is exactly your picture. raw = the model's whole redraw of the crop.

Outputs (2)

NameTypeDescription
imageIMAGEYour picture with the masked area painted.
maskMASKWhere it was pasted back (soft edge).