Nodes//Nougan MOSS RefMod Bake 🧬
ComfyUI Node

Nougan MOSS RefMod Bake 🧬

MOSS-Image references, scaled the way Ostris's example actually scales them

By WinnouganΒ·Created 3 months agoΒ·Updated about 16 hours agoΒ· 10
Nougan MOSS RefMod Bake 🧬
  • images
  • vae
  • image_2
  • image_3
  • image_4
  • path
β—„namemy_characterβ–Ί
β—„scale_modeβ–Ύβ–Ί
β—„resolution1024β–Ί
β—„subfoldermossβ–Ί
β—„overwritefalseβ–Ί

Here's a small thing that ruins more reference-based character work than any sampler setting: the reference was resized differently at bake time than it was at training time. One megapixel of a portrait cropped to square is not the same input as one megapixel with the aspect preserved. The model notices, and it comes out as a character who's approximately your character.

Nougan MOSS RefMod Bake 🧬 is careful about exactly that, and it's the reason I'd reach for it over rolling my own encode path. It bakes MOSS-Image references into a reusable .safetensors in models/refmods/moss/, and it gives you a switch for which resize convention to follow.

The two scale modes

scale_mode is the setting that matters:

  • kontext (matches Ostris example) - does what the Ostris example workflow does: run each reference through FluxKontextImageScale, i.e. pick the nearest ~1MP preset by aspect ratio and center crop. Predictable, training-shaped, and it will happily cut the top off a tall image.
  • megapixels - keep the whole image, scale to about resolutionΒ² pixels, snap to 16. Nothing cropped. Aspect survives, resolution lands wherever it lands.

If you're following Ostris's MOSS workflow, use kontext and stop second-guessing. If you're feeding it a reference you can't afford to crop (full-body, group shot), use megapixels and set resolution thoughtfully. resolution (default 1024) only applies in megapixels mode; 0 keeps each image's own size.

What it bakes

MOSS-Image, like Krea 2, doesn't just append latents - the text encoder looks at the image too. So each baked reference stores two tensors: the latent (vae.encode() of the reference, snapped to 16px) and a small uint8 copy of the image sized down into 384Γ—384 total pixels, which is what the encoder's vision tower actually receives. Baking removes the VAE work and gives you a library; it doesn't remove the vision pass.

images is the batch, and every frame becomes one reference, capped at 8. image_2…image_4 are there for graphs where references arrive on separate wires. vae must be the MOSS-Image VAE - the FLUX.2 VAE - not an SD or Flux 1 VAE, which produce latents in the wrong shape for a 16px-snapping FLUX.2 latent grid.

name, subfolder (moss), overwrite (off by default) behave as you'd expect. One output: path, the file written. It's an output node, so queue to run it.

The prerequisite nobody mentions first

Stock MOSS-Image ignores reference latents. To use what you bake you need:

  1. An edit-trained MOSS-Image model or LoRA (the ai-toolkit "MOSS-Image … [Edit Training]" path).
  2. ostris/ComfyUI-MOSS-Image-Ostris-Edit installed, with MOSS-Image Ostris Edit Model Patch on the MODEL line.

The pack doesn't vendor that patch; it just produces the identical conditioning. So baking alone gets you a nice file and no effect.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/Winnougan/Nougan_Nodes
git clone https://github.com/ostris/ComfyUI-MOSS-Image-Ostris-Edit
# restart ComfyUI

Both are on ComfyUI Manager if you prefer clicking. No pip dependencies from the pack itself - it declares none. Restart, hard-refresh (Ctrl+F5) for the refmod card UI, then bake.

Where people get burned

Cropping casualties. kontext mode center-crops. A full-body reference becomes a chest-up reference and you'll spend an hour blaming the LoRA. Switch to megapixels for anything where the frame is the point.

Eight references, then wondering why the sampler is miserable. Cap is 8, not a recommendation. Every reference costs tokens in every block.

Wrong VAE. It'll bake without complaining, then the latents won't line up. FLUX.2 VAE, always.

Baked, wired, ignored. No model patch on the MODEL path. Check that before anything else.

CategoryNougan/RefMod

Inputs (10)

NameTypeDefaultDescription
imagesIMAGEEvery frame in the batch becomes one reference (max 8).
vaeVAEThe MOSS-Image VAE (FLUX.2 VAE).
nameSTRINGmy_characterβ€”
scale_modeCOMBOkontext = what the Ostris example workflow does (FluxKontextImageScale: nearest ~1MP preset by aspect, center-cropped). megapixels = keep the full image, scale to resolution^2 pixels.
resolutionINT10240–4096Only used by scale_mode 'megapixels': about resolution x resolution pixels (1024 = ~1MP), then snapped to 16 px. 0 keeps each image's size.
subfolderSTRINGmossβ€”
overwriteBOOLEANfalseβ€”
image_2optIMAGEβ€”
image_3optIMAGEβ€”
image_4optIMAGEβ€”

Outputs (1)

NameTypeDescription
pathSTRINGβ€”