π Inpaint Flux Kontext
Masked inpainting for the Flux Kontext crowd
- positive
- negative
- vae
- pixels
- mask
- positive
- negative
- latent
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:
- 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_maskon both positive and negative conditioning - this is what tells the model "these pixels are fixed context." - The twist: it also appends the original image as a
reference_latentto 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. - 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.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| positive | CONDITIONING | β | |
| negative | CONDITIONING | β | |
| vae | VAE | β | |
| pixels | IMAGE | β | |
| mask | MASK | β | |
| noise_mask | BOOLEAN | true | Add a noise mask to the latent so sampling will only happen within the mask. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| positive | CONDITIONING | β |
| negative | CONDITIONING | β |
| latent | LATENT | β |