Nodes/ComfyUI-YarvixPA/πŸš€ Inpaint Flux Kontext
ComfyUI Node

πŸš€ Inpaint Flux Kontext

Masked inpainting for the Flux Kontext crowd

By YarvixPAΒ·Created about a year agoΒ·Updated 6 months agoΒ· 14
πŸš€ Inpaint Flux Kontext
  • positive
  • negative
  • vae
  • pixels
  • mask
  • positive
  • negative
  • latent
β—„noise_masktrueβ–Ί

Instruction-editing models took over most of what people used inpainting for, but they have a real weakness: they regenerate the whole image, so unmasked areas drift with every edit. Masked inpainting still owns the job where nothing outside the mask may change. This node is the pack's take on feeding a mask-based inpaint into the Flux Kontext family - and the key difference from the pack's plain inpainting node is right in the name: it adds the reference-image channel that Kontext-style models expect.

If you're running the YarvixPA - FLUX1 Kontext (GGUF) style workflows, or any Flux Fill / Kontext GGUF setup, this is the conditioning node the graph is built around.

How it works

Given your conditioning, a VAE, the image and a mask, it does the classic inpaint dance with a Kontext twist:

  1. It blanks the masked region of the image (drops the pixels toward neutral), then VAE-encodes that masked image as a concat latent and sets concat_latent_image + concat_mask on both positive and negative conditioning - this is what tells the model "these pixels are fixed context."
  2. The twist: it also appends the original image as a reference_latent to both conditionings. That reference channel is how Kontext/Fill-style models pull visual context of the whole scene, so the model knows what the rest of the image looks like while regenerating only the masked area.
  3. The latent it returns carries the original image's VAE encoding plus a noise_mask (default on), so sampling happens only inside the mask.

It also rounds the working resolution down to a multiple of 8 before encoding, so you don't trip latent-size errors.

Inputs and outputs

  • positive / negative - your text conditioning.
  • vae - the model's VAE.
  • pixels - the image to inpaint.
  • mask - where to inpaint. White = the region that gets regenerated.
  • noise_mask - default on; keeps sampling inside the mask.

Outputs: positive, negative, and latent (feed the latent to your sampler, usually with a VAE Decode on the other side).

Install

ComfyUI Manager (search "YarvixPA") or

cd ComfyUI/custom_nodes
git clone https://github.com/YarvixPA/ComfyUI-YarvixPA

restart. It's under ComfyUI-YarvixPA/Flux/Kontext. No downloads of its own.

The choice you're actually making

This node vs. the pack's plain InpaintConditioningNode comes down to the reference channel. Use this one with Kontext/Fill-family models that consume reference images - without the reference, those models can lose scene context and drift. Use the plain node with models that don't read reference_latents, where the extra channel is dead weight. And as always with noise masks: the tooltip on the sibling node says it best - "might improve results or completely break things depending on the model." Keep noise_mask on unless the output looks wrong, then flip it and compare.

CategoryComfyUI-YarvixPA/Flux/Kontext

Inputs (6)

NameTypeDefaultDescription
positiveCONDITIONINGβ€”
negativeCONDITIONINGβ€”
vaeVAEβ€”
pixelsIMAGEβ€”
maskMASKβ€”
noise_maskBOOLEANtrueAdd a noise mask to the latent so sampling will only happen within the mask.

Outputs (3)

NameTypeDescription
positiveCONDITIONINGβ€”
negativeCONDITIONINGβ€”
latentLATENTβ€”