Files
ausboss-ComfyUI-AusBoss/js/docs/AUSBOSS_NODES_Krea2Encode.md
T
ausboss ec50d3acfe Promote the Krea 2 outpaint pair from the lab
Krea 2 accepts reference latents, but they arrive with no position, so the
model treats them as a loose style hint: it borrows the look and reinvents
the content. That is the whole reason an outpaint drifts instead of
continuing the photo.

Krea 2 Encode attaches the reference latents and emits the negative from
the same node, so a turbo graph at CFG 1.0 stops carrying a second text
encode that does nothing. Krea 2 Outpaint Model Patch registers those
reference tokens into the target grid at the rectangle the stitcher
records, on frame axis 1.

Load Image + Pad gained a `reference` output - the unpadded source, fitted
to a 384px long edge and a multiple of 16, because the VAE downsamples by
8 and the DiT patchifies by 2. It is APPENDED after `stitcher`, never
inserted: a workflow stores links by output slot index, so any other
position silently rewires every saved graph.

The stitcher now records where the source sits, as source_bbox in pixels
and bbox_normalized in 0..1. Padding knows the rectangle exactly, so it
rides with the canvas instead of a parallel wire that can be left
unplugged. apply_stitch reads neither key, so an older stitcher stitches
identically.

Ported from the lab rather than copied: the lab's _krea2_helpers had its
own pad_image, feather_pad_mask, plan_pad_canvas, parse_fill_color and
build_canvas_stitcher. Duplicating the padding engine here would let the
outpaint path and the inpaint path disagree about what a stitcher is, so
the public module keeps only what is specific to Krea 2 and uses the
existing helpers for the rest.

Two departures from the lab version. The model patch declared a kv_cache
input and never read it - the cache was always on - so it is wired up now.
And it imports comfy's flux internals when you run it rather than at
startup: a core release that moves one then surfaces as an error on that
node, instead of deleting it from the menu and leaving saved workflows
reporting it missing.
2026-08-17 22:17:19 -05:00

44 lines
2.1 KiB
Markdown

# Krea 2 Encode
Encodes a Krea 2 prompt pair and attaches reference latents, in one node.
Wire a VAE and a reference image and the reference is encoded and appended to
the positive conditioning. Leave them unwired and this is a plain two-prompt
encoder. The negative comes out of the same node, so a turbo graph running at
CFG 1.0 still has something to plug in without a second text encode sitting
there doing nothing.
## Controls
- **clip**: The Krea 2 text encoder.
- **prompt**: Describe the whole finished canvas, not just the new area — the
model generates all of it and matches the reference where it must.
- **negative_prompt**: Ignored at CFG 1.0, which is where turbo runs. Empty is
the normal case there.
- **vae**: Needed to turn the reference images into latents. Without it the
references are skipped and only the prompts are encoded.
- **reference**: The `reference` output of Load Image + Pad 🆎 — the unpadded
source. Any image works; it is fitted to a multiple of 16 first.
- **extra_image**: A second reference, e.g. a style or character plate.
- **vlm_reference**: Also show the references to the vision tower, so the text
encoder describes them. Off for outpaint: the latents already carry the
picture, and the description tends to pull the result toward a paraphrase of
the source.
## Outputs
- **positive**: Prompt conditioning with the reference latents attached.
- **negative**: Negative prompt conditioning.
## Notes and limitations
- **References are downscaled to a 384px long edge and snapped to a multiple
of 16.** The VAE downsamples by 8 and the DiT patchifies by 2, so an edge off
a multiple of 16 lands on a partial patch and the token grid stops lining up
with the canvas grid. The cap is deliberate — a reference is there to say
"this is the picture", and the canvas latent carries the detail.
- Attaching reference latents alone does not tell the model *where* they go.
Pair this with Krea 2 Outpaint Model Patch 🆎 for outpainting.
- On a core without the Krea 2 prompt template, `vlm_reference` still works —
it falls back to tokenizing without the template.