Nodes/NK2E/NK2E In-Context Edit
ComfyUI Node

NK2E In-Context Edit

One node turns any Krea 2 image into an edit you can prompt

By Nynxz·Created 2 months ago·Updated about a month ago· 13
NK2E In-Context Edit
  • model
  • reference
  • MODEL

You know the Krea 2 trick: type "give her pink hair" and the image obeys. That's in-context editing, and until the official edit model ships, NK2E is how you get it locally. NK2E In-Context Edit is the simplest node in Nynxz's pack for it - drop a source image and a text instruction in, get an edited image out, no inpainting masks, no img2img dancing.

A quick reality check first, because the README is refreshingly honest: this is experimental and unofficial, the results are "rough and inconsistent, and vary a lot by edit type," and it is not affiliated with Krea. It works - the shipped example turns a plain portrait into "she has pink hair, white red and blue 3d glasses, a headband with fake pink cat ears" - but treat it as a sharp toy, not a production tool.

How it actually edits

In-context editing works differently than img2img. Your reference image gets VAE-encoded, then its tokens are concatenated onto the image token stream before the model's attention blocks. Each reference becomes its own token block tagged with a position index (target = 0, reference = 1), which is how the model keeps "this is the image I'm editing" and "this is the reference" straight. The text instruction is what tells it what to change. The node does this by registering a wrapper on a cloned model through ComfyUI's patcher_extension system, intercepting the forward pass.

The node itself only takes two inputs and returns one output:

  • model (MODEL) - the Krea 2 checkpoint, usually after the NK2E LoRA is applied.
  • reference (LATENT) - a VAEEncode of your source image.
  • MODEL output - wire this into a KSampler.

Wiring it like the author does

Drag the pack's workflow.json into ComfyUI and you get the full graph. In a nutshell:

UNETLoader (krea2_turbo) -> LoraLoaderModelOnly (NK2E LoRA ~0.75) -> NK2E In-Context Edit
LoadImage -> ImageScaleToTotalPixels -> VAEEncode -> reference (and the KSampler's latent)
CLIPTextEncode (the instruction) -> KSampler positive

The KSampler runs at denoise 1.0, ~4 steps, CFG 1, euler/simple - that's the Krea 2 Turbo profile. Because denoise is 1.0, the source latent feeding the sampler is only setting the canvas size; the actual edit comes from the reference path through this node. Use ConditioningZeroOut for the negative prompt slot; Krea 2 at CFG 1 gets grainy output without one.

Install

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

Then restart ComfyUI - or use ComfyUI Manager and search for NK2E. There are no pip dependencies (pyproject.toml declares none), but you do need three more files than you think:

  • NK2E-v1.0.safetensors - the edit LoRA, from nynxz/NK2Ecomfy/
  • krea2_turbo_bf16.safetensors, the Qwen3-VL text encoder, and the Qwen-Image VAE, from Comfy-Org/Krea-2

People routinely miss the text encoder and VAE and then blame the node. Krea 2 runs at 8GB VRAM in FP8; 16–24GB is comfortable.

Where people get burned

  • Silent failures. If the wrapper throws, the node falls back to a normal generation - you get a image, just not an edit. Check the console for [NK2E] ... forward failed.
  • Old ComfyUI. This needs the modern patcher_extension API and the new extension system. On a stale install the nodes don't appear or crash at import.
  • It's marked deprecated. The author flagged it as a legacy node - it bakes the reference into the model, so every time you change the reference it reloads. For iterating, the reload-free pair (NK2E In-Context (Model) + NK2E Set Reference) is the better path. For a one-shot edit, this is still the easiest node in the pack.
  • The base model's quirks come along. Krea 2's open weights went through alignment training that flattens expressions and drops prompt clauses. Your edits inherit that; if a face comes out blank, it's the model, not the wiring.
CategoryNK2E

Inputs (2)

NameTypeDefaultDescription
modelMODEL
referenceLATENT

Outputs (1)

NameTypeDescription
MODELMODEL