Krea2 Edit (source patch)
Where your photo actually gets injected into Krea 2
- model
- source_latent
- source_latent_b
- ref_boost_mask
- vae
- source_image
- source_image_b
- target_latent
- MODEL
Krea's official edit model still hasn't shipped, so right now the best "edit a photo with a sentence" tool for Krea 2 is a community one: the Krea 2 Identity Edit LoRA by conradlocke, with this node pack supplying the plumbing. Krea2EditModelPatch is the appearance half of that plumbing. The source image you're editing gets VAE-encoded and prepended as in-context tokens inside the diffusion model, so the model treats "keep this person" as something it structurally can't forget - not as a prompt clause it might ignore.
It's the same family of trick as Flux.1 Kontext: reference images consumed in-context rather than injected as adapter embeddings the way IP-Adapter or PuLID do, here wrapped around Krea 2's single-stream DiT and matched to how the LoRA was trained. Krea2EditGroundedEncode handles the semantic half (the text encoder reads the image while reading your instruction) - you need both nodes, and this one goes between your LoRA loader and the sampler.
How it works
The node clones your model and installs a wrapper on the diffusion-model patcher. On each denoise step the VAE-encoded source is scaled into the same latent space as the target and prepended as clean tokens at RoPE frame 1 - a second reference (two-image edits) lands at frame 2. ref_boost then multiplies target→reference attention to pull harder toward (or loosen from) the reference's appearance.
You feed the source one of two ways. The latent path is just source_latent from a VAEEncode - dead simple, but if the source resolution doesn't match the output, the resampling gets sloppy and reference quality turns blurry. The pixel path (vae + source_image) crops and resizes in pixel space, then encodes internally. It's the blur-proof option, it makes mismatched aspect ratios safe, and it's the one people end up on.
The inputs that matter
model(required) - your Krea 2 model with the Identity Edit LoRA already applied viaLoraLoaderModelOnly. Patch on top of a model without the LoRA and nothing will behave.source_latent(required) - VAEEncode of the image being edited.vae+source_image(optional, recommended) - the pixel path. Required if you wantfit_mode: fitto do anything.target_latent(optional, recommended with the pixel path) - wire the same latent that feedsKSampler.latent_image. More on this below; it's the one that bites people.fit_mode(defaultfit) - how a source fits a mismatched output aspect ratio.fit= the training-matched centered resample (v1.2).crop (legacy)= the v1/v1.1 center-crop geometry; use it only with older weights.ref_boost/ref_boost_a(default 1.0) - the fidelity dials.>1pulls harder toward the reference's appearance,<1loosens.ref_boosthits the last reference (the subject in two-ref work),ref_boost_ahits the first (the scene).ref_boost_mask(optional) - a region of the reference to boost, e.g. just the face.
Output is a MODEL - wire it into KSampler.model.
The target_latent gotcha
The pixel path has to VAE-encode the source at the output resolution. Without target_latent the node doesn't know that resolution until sampling starts, so the encode lands on the first step - mid-run, with the diffusion model already resident. ComfyUI frees room by partially offloading whatever's loaded, sampler included, and nothing loads it back. Every remaining step then streams weights from CPU. Wiring target_latent moves the encode to node-execution time and restores the sane VAEEncode → KSampler order. The console tells you which path you're on - look for pre-encoding sources at target ... (before sampling...) (good) versus a NOTE: connect 'target_latent' (bad). Measure over 20+ steps, not 1: this is a per-step penalty, invisible on a single-step test run.
Install
ComfyUI Manager → search "Krea 2 Identity Edit", or:
cd ComfyUI/custom_nodes
git clone https://github.com/lbouaraba/comfyui-krea2edit
# restart ComfyUI
No Python dependencies. You do need the whole Krea 2 stack - the model (Raw or Turbo), the Qwen3-VL 4B text encoder (~8 GB, the thing people forget), the Qwen-Image VAE, and krea2_identity_edit_v1_2.safetensors from HuggingFace. The README's fast path is Turbo, 8 steps, CFG 1.
Common issues
- Blurry reference / lost identity - you're on the latent path with a resolution mismatch. Connect
vae+source_image; at matched resolution the two paths agree. fit_mode: fitdoes nothing - it silently requires the pixel path. The console warns when it falls back.- Removals re-render the subject - Turbo at CFG 1 usually redraws instead of deleting. Use Raw at CFG 3, ~20 steps, with a grounded negative.
- Ghosting / doubling on outpaint - keep dimensions on the /16 grid, and prefer
euleroverer_sdefor outpainting (the SDE noise wrecks the reference-copy channel). - Generate ≤ 2 MP - above the trained range, source content bleeds and subjects duplicate. And "zoom out" is genuinely tricky on current weights; plan around it.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| source_latent | LATENT | — | |
| source_latent_bopt | LATENT | 2nd reference (subject photo) for multi-ref LoRAs -> RoPE frame=2, training-matched order: scene first, subject second | |
| ref_boostopt | FLOAT | 1.000–1000 | reference-fidelity dial: multiplies target->reference attention. Applies to the LAST ref (= the subject in two-ref workflows, the only ref in single-ref). 1.0 = off, >1 pulls harder toward the reference's appearance, <1 loosens. Optimal value is model-specific |
| ref_boost_aopt | FLOAT | 1.000–1000 | same dial for the FIRST ref (= the scene in two-ref workflows). No effect in single-ref workflows. 1.0 = off |
| fit_modeopt | COMBO | fit | how an image source fits a mismatched output aspect ratio (needs vae + source_image connected): fit = resample the source to the target grid at a centered offset — matches how this model was trained (default, use this); crop (legacy) = center-crop to the target AR then resize (v1/v1.1 geometry, only for older weights) |
| ref_boost_maskopt | MASK | optional region on the (last) reference to boost, e.g. the face; empty = whole reference | |
| vaeopt | VAE | RECOMMENDED with source_image: enables the blur-proof pixel-space path (crop+resize in pixels, encode internally) — immune to input/output resolution mismatches | |
| source_imageopt | IMAGE | source as IMAGE (with vae connected): overrides source_latent with exact pixel-space fitting — fixes blurry results from mismatched resolutions | |
| source_image_bopt | IMAGE | 2nd reference as IMAGE (with vae) | |
| target_latentopt | LATENT | RECOMMENDED with vae + source_image: wire the SAME latent you feed KSampler.latent_image. Lets the node VAE-encode the source here, before sampling starts, instead of on the first step — otherwise the VAE is pulled onto the GPU mid-sampling and can evict part of the diffusion model, slowing every remaining step on VRAM-tight setups |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |