ComfyUI Node

pre_Kontext

Single-image Kontext editing preset — deprecated

By cardenluoĀ·Created 2 years agoĀ·Updated 22 days agoĀ· 309
pre_Kontext
  • context
  • image
  • mask
  • context
  • positive
  • latent
ā—„prompt_weight0.50ā–ŗ
ā—„smoothness0ā–ŗ
ā—„auto_adjust_imagefalseā–ŗ
ā—„posā–ŗ

pre_Kontext was Apt_Preset's single-image preset for Flux Kontext-style instruction editing - feed it an image, a text instruction, and optionally a mask to restrict the edit to a region. It's now filed under the pack's own "Deprecated" category - worth noting, its multi-image sibling pre_Kontext_mul_Image carries the exact same deprecated label, so both single- and multi-image Kontext presets in this pack have been superseded together, presumably by a newer combined node in the pack's "General Control Kontext Stack" (referenced in the README's changelog) rather than one replacing the other.

What Kontext is, for context

Flux Kontext is Black Forest Labs' instruction-based image editor: give it an image and a sentence, and it changes what you asked for while consuming the reference image in-context rather than through a separate adapter. It made instruction editing a local commodity and became the backbone of a lot of character-consistency and turnaround-sheet workflows when it shipped. What it - and every instruction editor like it - genuinely can't do is guarantee the rest of the image stays untouched: because the whole frame gets re-emitted from context, unmasked regions tend to drift slightly, which is exactly why masked inpainting on a non-edit model still has a place even in a Kontext-heavy workflow. That's also why this node exposes an optional mask at all - it's the same idea as constraining an edit model's blast radius rather than trusting the whole-frame result.

How it worked

You'd wire in an image and a text instruction (pos), optionally a mask to limit the edit's scope, and tune prompt_weight to balance how strongly the text instruction versus the image itself drives the output. auto_adjust_image, if enabled, likely handled resizing or cropping the input toward whatever resolution Kontext prefers internally - a real and commonly-reported friction point with Kontext-family models generally, since they tend to perform best at specific aspect ratios and resolutions rather than whatever you hand them.

Inputs and outputs

  • context (required) - the RUN_CONTEXT chain.
  • image (optional IMAGE) - the reference/source image.
  • mask (optional MASK) - restricts the edit to a region.
  • prompt_weight (0–1, default 0.5) - balance between the text instruction and the image reference.
  • smoothness (default 0, up to 10) - mask edge feathering.
  • auto_adjust_image (BOOLEAN, default false) - automatic resize/crop toward Kontext's preferred input shape.
  • pos (multiline STRING, default empty) - the edit instruction.

Outputs: context, positive (CONDITIONING), latent (LATENT).

What to use instead

Both this node and its multi-image sibling, pre_Kontext_mul_Image, are deprecated in the current pack - so don't reach for either if you're building fresh. Check the pack's active node list for whatever now covers Kontext-style editing; the README's changelog mentions ongoing work on a "General Control Kontext Stack" that these older preset nodes most likely fed into before being consolidated.

Installing the pack

ComfyUI Manager: search "ComfyUI-Apt_Preset", install, restart. Manually:

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

Restart afterward, then run install.bat on Windows or the equivalent pip install from the repo's requirements file on Linux/Mac.

Common issues

Edit result drifts details outside the intended change. That's the standard instruction-editor trade-off, not specific to this node - Kontext re-emits the whole frame from context, so anything not covered by a mask can shift slightly, more so across repeated edits. Use the mask input if you need the rest of the image to stay put.

Results look soft or oddly cropped. Check auto_adjust_image - if it's silently resizing your input toward a preferred resolution, that can produce unexpected framing. Toggle it and compare.

Node is hard to find in the menu. It's under the pack's deprecated category now - browse there directly, or move to the current active Kontext node in the pack instead of hunting for this one.

CategoryApt_Preset/🚫Deprecated/🚫

Inputs (7)

NameTypeDefaultDescription
contextRUN_CONTEXT—
imageoptIMAGE—
maskoptMASK—
prompt_weightoptFLOAT0.500–1—
smoothnessoptINT00–10—
auto_adjust_imageoptBOOLEANfalse—
posoptSTRING—

Outputs (3)

NameTypeDescription
contextRUN_CONTEXT—
positiveCONDITIONING—
latentLATENT—