Nodes/ComfyUI-Apt_Preset/Stack_Kontext_MulCondi
ComfyUI Node

Stack_Kontext_MulCondi

Three Different Edit Instructions, Three Different Masks

By cardenluoĀ·Created 2 years agoĀ·Updated 18 days agoĀ· 309
Stack_Kontext_MulCondi
  • image
  • mask
  • mask1
  • mask2
  • mask3
  • kontext_MulCondi
ā—„pos1ā–ŗ
ā—„pos2ā–ŗ
ā—„pos3ā–ŗ

Flux Kontext and its relatives (Qwen-Image-Edit, Flux 2 Klein) work from a sentence: hand them an image and an instruction, and they hand back an edited version. That's great for one change at a time. Stack_Kontext_MulCondi is built for when you want several different, independently-masked changes applied in one pass - swap the jacket in one region, change the background in another, retouch a third - instead of running the edit model three separate times and hoping the earlier edits survive.

Inputs

Every field here is optional:

  • image - the base image you're editing.
  • mask - an overall mask, alongside the three region-specific ones below.
  • pos1 / pos2 / pos3 - up to three separate text instructions, each describing what should happen in its own region.
  • mask1 / mask2 / mask3 - the mask pairing with each posN instruction.

Output: kontext_MulCondi, a KONTEXT_MUL_PACK object meant for the pack's own Kontext-consuming sampler node.

Why this matters for Kontext specifically

Kontext-style models don't work like ControlNet or IP-Adapter, injecting an embedding alongside your prompt - they concatenate the reference image directly into the model's own context, which is why they hold a subject together across edits better than adapter-based tools do. That in-context design is also why doing several distinct local edits in one call is worth building a node for: rather than three sequential edit passes (each one re-encoding and potentially drifting the parts you didn't mean to touch), Stack_Kontext_MulCondi packages the region-instruction pairs together so the model can reason about all three in the same context window.

What's not confirmed here

The exact mechanism this bundle uses once it reaches a sampler - whether the three regions get processed as one combined instruction or handled as separate passes internally - isn't visible from this node's schema alone, and the KONTEXT_MUL_PACK type doesn't match any input on another node in this batch of 20. If you're building a workflow around this, check Apt_Preset's own example workflows for the node that actually consumes it.

Setting it up

Keep your posN instructions specific and scoped to what their matching mask actually covers - "make this jacket blue" reads better to an edit model than a vague instruction competing with two other regions for the same context. Start with two regions before trying all three; multi-region edits compound whatever ambiguity a single-region edit already has.

Install

ComfyUI Manager: search "ComfyUI-Apt_Preset," install, restart. Manually: cd ComfyUI/custom_nodes && git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git, then restart ComfyUI. Its install.bat dependency installer only runs on Windows - on Linux or a cloud box, read what it lists and pip-install those packages yourself, or let ComfyUI Manager's "install missing nodes" flow catch it.

Troubleshooting

If a region doesn't seem to change, double check that both its posN text and its matching maskN are actually connected - all six fields are optional, so a half-wired region just gets silently skipped rather than erroring.

This pack has real, reported import failures - a comfyui subreddit thread shows a console error reading (IMPORT FAILED): ...ComfyUI-Apt_Preset for someone loading a workflow that used it. ComfyUI Manager's "install missing custom nodes" resolved it, as did manually deleting and re-cloning the repo and restarting.

CategoryApt_Preset/stack/😺backup

Inputs (8)

NameTypeDefaultDescription
imageoptIMAGE—
maskoptMASK—
pos1optSTRING—
pos2optSTRING—
pos3optSTRING—
mask1optMASK—
mask2optMASK—
mask3optMASK—

Outputs (1)

NameTypeDescription
kontext_MulCondiKONTEXT_MUL_PACK—