EditUtils: MOSS-Image Config Preparer lrzjason
Per-image settings for MOSS-Image, and the one default you should probably leave alone
- image
- configs
- mask
- configs
- config
An edit model doesn't see "an image". It sees a text-encoder input and a latent, sized on a grid, padded or cropped to fit. MossImageConfigPreparer_EditUtils is where you decide all of that for one reference - and it's the node where a wrong default quietly costs you fidelity.
What it is, in the MOSS path
The pack's MOSS-Image support is a retrofit: MOSS-Image is text-to-image, and EditUtils bolts a reference path onto it in the same shape as its Krea2 editing route. One preparer per image, chained. Each one carries two copies of the picture, because two different components need it:
- a vision copy for Qwen3.5-9B's vision tower, resized to roughly
vl_target_sizesquared worth of area, so the prompt can sayPicture n:and mean something; - a reference latent from the FLUX.2 packed VAE, 128 channels at 16 px per token, snapped to a 16 px grid.
Same image, two pipelines, sized independently. That's why there are eleven knobs on what looks like "add an image" node.
The inputs you'll actually touch
image is required. configs is the chain: leave it blank for the first reference, feed the previous preparer's configs output into the next one's for references 2, 3, n.
ref_longest_edge (default 1024, step 16) is the reference size, snapped to 16 px multiples. Around 1 MP is the trained range here; a 1024×1024 reference adds 4096 tokens to the sequence on every step, and the patch node's K/V cache keeps that number in your RAM budget.
ref_crop (default center) is the interesting one. center does an aspect-preserving fit with a minimal centre crop - closest to the fit the edit training used, which is why it's the default rather than pad. pad fills out to a /16 canvas (that's when pad_mode, pad_color, pad_color_rgb and pad_noise start mattering), and disabled resizes without cropping. If you're editing a picture whose edges matter, pad with border_mean will save you from a centre crop that ate the subject's shoulder.
ref_resize_mode picks what "1024" means: longest_edge scales so the longest side equals it, area scales so total pixels equal 1024². Area mode keeps token counts comparable between landscape and portrait references.
to_ref and ref_main_image work as everywhere else in the pack: to_ref puts the image in the reference latents (keep it on), ref_main_image names the picture being edited (only the first in the chain wins, and its pixels are what you'll see coming out as main_image).
to_vl (default on) feeds the reference to the vision tower. The tooltip says keep it on for the trained recipe, and it's right - MOSS's grounding is the whole reason a reference can influence the prompt's Picture n: token.
vl_resize, vl_target_size (default 384), vl_crop and vl_upscale control that vision copy. 384 means 384×384 of area, not a 384 px long edge. bicubic or area beats lanczos when shrinking, which is why the default is bicubic while the VAE copy defaults to lanczos.
mask attaches to the main image and rides through as a noise mask on the output latent - unlike the MiniMax H3-Image route, which has nowhere to put it.
Outputs: configs (the whole chain, into EditTextEncode_EditUtils) and config (this one entry, for chaining forward).
How it fits together
UNETLoader (moss_image_sft_int8_convrot) ──► MossImageEditApply ──► [LoRA] ──► KSampler ──► VAEDecode ──► SaveImage
CLIPLoader (qwen3.5_9b_w4a8_gptq, type moss_image) ─┐
VAELoader (flux2-vae) ─────────────────────────────┤
LoadImage ──► MossImageConfigPreparer ──────────────┼──► EditTextEncode_EditUtils ──► positive / latent
MossImageModelConfig ───────────────────────────────┘
Starting point from the pack: euler/simple, 30 steps, CFG 3.0, ref_strength=1.0 on the patch node.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/lrzjason/ComfyUI-EditUtils
# restart ComfyUI
ComfyUI Manager users: search ComfyUI-EditUtils. No pip dependencies - the pack has no requirements file, it's all ComfyUI core. You do need a build with native MOSS-Image support, plus moss_image_sft_int8_convrot / qwen3.5_9b_w4a8_gptq / flux2-vae, and an edit LoRA. Without the LoRA the reference is a conditioning signal nothing was trained to read.
Common issues
References have no effect. In order of likelihood: no edit LoRA, no MossImageEditApply_EditUtils on the model wire, or to_ref switched off.
Sizes snapping to odd numbers. The latent grid is 16 px. ref_longest_edge steps by 16 for that reason; a 1000 px reference becomes 992 or 1008 and that's the machine being honest, not broken.
Instant quality drop after switching from center to pad. You're now feeding the VAE letterboxing it rarely saw in training. If you need the whole frame, try pad_mode=border_mean or mirror before giving up on it.
Inputs (18)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| configsopt | LIST | Configs list | |
| to_refopt | BOOLEAN | true | Add image to reference latent |
| ref_main_imageopt | BOOLEAN | true | Set image as main image which would return the latent as output. |
| ref_longest_edgeopt | INT | 102416–4096 | Reference target size; snapped to 16-pixel multiples (FLUX.2 VAE, 128 channels). ~1 MP is the trained range. |
| ref_cropopt | COMBO | center | How the reference fits a non-matching aspect ratio. center = aspect-preserving fit with a minimal center crop (default, closest to the edit-training fit); pad = fill to a /16 canvas; disabled = resize without cropping. |
| ref_upscaleopt | COMBO | lanczos | Resize filter for the reference image |
| to_vlopt | BOOLEAN | true | Feed the reference to the Qwen3.5-9B vision tower (Picture n: vision grounding). Keep on for the trained edit recipe. |
| vl_resizeopt | BOOLEAN | true | Resize before the vision encode |
| vl_target_sizeopt | INT | 384384–2048 | Target area for the vision encode (vl_target_size squared) |
| vl_cropopt | COMBO | center | Crop method for the vision encode |
| vl_upscaleopt | COMBO | bicubic | Resize filter for the vision encode; bicubic/area are better than lanczos when downscaling |
| pad_modeopt | COMBO | color | How to fill the padding area when ref_crop == pad |
| pad_coloropt | COMBO | black | Pad fill color when pad_mode == color; black is the safe FLUX.2/MOSS default |
| pad_color_rgbopt | STRING | - | Optional override: 6-digit hex color, with or without '#' (e.g. FF0000 or #FF0000). When valid it overrides pad_color. Anything else ("-", wrong length, non-hex, numbers, "r,g,b") is ignored |
| pad_noiseopt | FLOAT | 0.000–0.2 | Gaussian jitter (std) added to the pad area to avoid perfectly flat regions; 0.02-0.05 recommended with solid colors |
| maskopt | MASK | — | |
| ref_resize_modeopt | COMBO | longest_edge | longest_edge: scale so the longest dimension equals ref_longest_edge. area: scale so total pixels equals ref_longest_edge squared. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| configs | LIST | — |
| config | ANY | — |