Nodes/ComfyUI-Image-Filters/Inpaint Condition Apply
ComfyUI Node

Inpaint Condition Apply

Turn a pre-encoded inpaint mask into conditioning, fast

By spacepxl·Created 3 years ago·Updated 8 months ago· 293
Inpaint Condition Apply
  • positive
  • negative
  • inpaint_condition
  • latents_optional
  • positive
  • negative
  • latent
noise_maskfalse

This is the second half of the pack's inpaint-conditioning pair. Inpaint Condition Encode does the one-time, expensive VAE encode of your image and mask; this node takes that pre-encoded bundle and, every time you run it, attaches your current positive and negative prompts to it and hands back conditioning plus a latent ready for the sampler. Swap the prompt, re-run this node, skip the encode - that's the whole point of splitting them apart.

Where it fits

If you're inpainting and iterating on wording - "try it with a red jacket," "no, try leather," "add rain" - you don't want to re-run the VAE encode of the base image and mask on every single attempt. That's the workflow this node is built for: encode once with its partner node, then loop Inpaint Condition Apply as many times as you want, feeding in a fresh prompt pair each time, while reusing the same encoded inpaint data. It's conceptually the same territory as ComfyUI core's InpaintModelConditioning node - giving an inpainting-aware checkpoint (Flux Fill and similar) the masked-region context it needs instead of just handing it an empty latent - but built specifically to let you decouple the slow part from the part you're actually iterating on.

Inputs and outputs

  • positive / negative (CONDITIONING) - your usual text-encoded prompts, which this node combines with the inpaint condition data.
  • inpaint_condition (the pack's INPAINT_CONDITION type) - comes straight from Inpaint Condition Encode. This is where the mask, image, and VAE encode already live.
  • noise_mask (boolean, default off) - the author's own tooltip is worth quoting directly: "Add a noise mask to the latent so sampling will only happen within the mask. Might improve results or completely break things depending on the model." In plain terms: turning this on restricts the sampler to only denoise inside your masked region, which is true inpainting behavior - but the author's own hedge tells you it's model-dependent, so treat it as something to test rather than assume is always better.
  • latents_optional (LATENT, optional) - lets you swap in a different latent than whatever came bundled in inpaint_condition, useful if you're chaining this into a workflow where the latent has already been through another step.

Three outputs: positive and negative CONDITIONING (now carrying the inpaint context, ready for your sampler), and latent - the LATENT to feed as your sampler's starting point.

Installing it

ComfyUI Manager: search "ComfyUI-Image-Filters," install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/spacepxl/ComfyUI-Image-Filters

pip install -r requirements.txt (or run install.bat on Windows), then restart. This node itself pulls no models - you need an inpainting-capable checkpoint separately, this pack just wires the conditioning.

The pack-wide install snag is OpenCV: it needs opencv-contrib-python, and a conflicting cv2 build from some other node pack can throw import errors for the whole repo on startup. import_error_install.bat fixes it by wiping every opencv variant and reinstalling the one this pack actually needs.

Common issues

The biggest trap is the noise_mask toggle - it's off by default for a reason, and the author's own tooltip explicitly warns it can "completely break things depending on the model." If your inpaint results suddenly go strange after flipping it on, flip it back off and test with your specific checkpoint before deciding either way is "correct." Second, this node is only as good as what it's fed: if inpaint_condition came from a mismatched image/mask pair, that error surfaces here, not at the encode step - check your mask alignment first if the inpainted region looks off. And remember this whole two-node pair only pays off across multiple prompt iterations on the same image; for a single one-shot generation, it's no faster than a normal inpaint conditioning setup.

CategoryImage-Filters/conditioning

Inputs (5)

NameTypeDefaultDescription
positiveCONDITIONING
negativeCONDITIONING
inpaint_conditionINPAINT_CONDITION
noise_maskBOOLEANfalseAdd a noise mask to the latent so sampling will only happen within the mask. Might improve results or completely break things depending on the model.
latents_optionaloptLATENT

Outputs (3)

NameTypeDescription
positiveCONDITIONING
negativeCONDITIONING
latentLATENT