(deforum) InpaintModelConditioning [safe]
The \"safe\" inpainting conditioning that keeps your animation on-model
- positive
- negative
- vae
- pixels
- mask
- latent
- deforum_frame_data
- positive
- negative
- latent
Inpainting inside an animation is where things usually break - masks drift, latent resolutions mismatch, and one wrong tensor shape kills a 200-frame run. (deforum) InpaintModelConditioning [safe] is the pack's guarded version of ComfyUI's built-in inpaint conditioning: same job (prepare positive/negative conditioning plus a latent for masked regeneration), but wrapped so that if it has nothing to do, it passes your inputs through untouched instead of crashing the graph.
What it does
Standard inpainting needs three things: a prompt conditioned on the masked region, a VAE-encoded latent of the region, and a noise mask so the sampler knows where to regenerate. This node produces all three from your positive/negative conditioning, a VAE, and your pixels + mask. It's the "masked inpainting" mechanic from the inpainting playbook - the masked area gets denoised while the unmasked region stays bit-identical, which is precisely what you want for fixing a face or an object across animation frames without the background drifting.
The "safe" part
The guarded behavior matters a lot in a loop. If no pixels/mask pair is provided - or if the deforum_frame_data reports a reset - the node returns your conditioning and latent unchanged. So the same graph handles both the inpainting frames and the normal frames without you rewiring anything. It also aligns the image to 8-pixel boundaries before encoding (the latent-space requirement), which silently prevents a whole class of shape-mismatch crashes.
Mechanically it mirrors ComfyUI's InpaintModelConditioning: mask downsampled to latent resolution, a noise_mask on the latent, concat_latent_image conditioning so the model sees the masked context. The pack flags it "[safe]" because the passthrough behavior keeps the animation loop alive when inpainting isn't active.
The inputs and outputs that matter
- positive / negative - your CONDITIONING, usually from a CLIP Text Encode.
- vae - the VAE to encode the masked pixels with.
- pixels (optional IMAGE) - the frame to inpaint.
- mask (optional MASK) - where to regenerate. White = regenerate, black = keep.
- latent (optional LATENT) - an already-encoded latent to pass through (used when the node is idle).
- deforum_frame_data (optional) - when
resetis true, the node goes idle.
Outputs:
- positive (CONDITIONING)
- negative (CONDITIONING)
- latent (LATENT, carrying the
noise_mask) - feed all three into your KSampler.
Installing this pack
Part of Deforum Nodes by XmYx. ComfyUI Manager: search Deforum Nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/XmYx/deforum-comfy-nodes
Restart and let install.py install the deforum-studio backend from GitHub plus the scientific-Python stack (numpy < 2.0, Python 3.10 required). No model downloads for this node - it's pure conditioning plumbing.
Common issues
- Nothing is being inpainted. If
pixels+maskaren't both connected (ordeforum_frame_data.resetis true), the node passes through by design. Check both inputs are live. - The whole frame changes, not just the mask. That's usually the sampler's denoise being set high globally. The node controls where to inpaint; the how much is your denoise/strength.
- Seams around the mask. The mask isn't feathered here - blur it upstream (a Blur Mask node) before feeding it in. A hard mask edge shows up as a hard seam.
- Resolution mismatch errors. The 8-pixel alignment only fixes the latent boundary; feed pixels at the resolution you're actually sampling, or things go sideways.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| vae | VAE | — | |
| pixelsopt | IMAGE | — | |
| maskopt | MASK | — | |
| latentopt | LATENT | — | |
| deforum_frame_dataopt | DEFORUM_FRAME_DATA | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| positive | CONDITIONING | — |
| negative | CONDITIONING | — |
| latent | LATENT | — |