EditUtils: Minimax H3 Image Config Preparer lrzjason
The H3I sizing node explained
- image
- configs
- mask
- configs
- config
Every reference-editing model has one node that's secretly in charge of whether your output looks good, and it's never the sampler. For MiniMax-H3-Image it's this one. Get the sizes wrong here and you get the H3I version of a JPEG of a JPEG: a soft, poster-ish image at 1 megapixel, no matter how pretty your prompt was.
What it's for
MinimaxH3ImageConfigPreparer_EditUtils takes one image and wraps it into a per-image config - everything the encoder needs to know about this reference: how big to make it, whether it's the picture being edited or just a reference, whether the text encoder gets to see it, and how to pad it if the aspect ratio doesn't cooperate.
The reason a whole node is spent on this: an H3-Image reference feeds two consumers with different needs. The Qwen3-VL text encoder wants a ~1024 px short-edge copy so it can emit a "Picture n: " vision block. The DiT wants a 24-channel VAE latent on its own grid. One node carries both halves, so the two can't drift apart.
And the sizes genuinely differ. H3-Image was trained at 4–20 MP (best around 16 MP). References like being around 1 MP. Those two facts don't fit on one dial, so there are two.
How it works
Two sizing rules, both snapped to 32 px because the VAE token is 16 px and the DiT patches 2×2:
ref_short_edge(default 1024) sets the short edge of the reference latent and the vision copy.ref_max_short_edge(2048) just clamps big inputs - anything larger only gets downscaled.scale_up(default 1.0) multiplies the main image's reference grid into the sampled target.ref_short_edge=1024withscale_up=2gives a ~4 MP square target from a ~1 MP reference, without ever upscaling the reference.
That last part is the whole design. You're not upscaling an image and hoping; you're telling the sampler to start from a bigger noise canvas than the reference occupies.
The inputs you'll actually touch
image is the only required input. configs is the chain: leave it unconnected for the first reference, and feed the previous preparer's configs output into the next one's for references 2, 3, 4… The README chains them; the count is unlimited, unlike the one-node encoder path.
ref_main_image (default on) marks this image as the picture to edit - its latent supplies the target grid. Only the first one in the chain wins, so if you chain three references and leave all three on, you've done nothing wrong but gained nothing. to_ref must stay on; H3I edits are driven by these latents and turning it off leaves you with a text encoder that's seen a picture the model hasn't.
ref_crop defaults to disabled, which is ComfyUI's own reference behaviour: aspect-preserving resize, no crop, no invented pixels. center and pad exist for fixed-canvas graphs. Only if you pick pad do pad_mode, pad_color, pad_color_rgb and pad_noise do anything - border_mean and mirror are the interesting options there, and a little pad_noise (0.02–0.05) stops solid fills reading as flat blocks.
to_vl (default on) gives the reference to the text encoder as a vision block. Turn it off and the prompt can still say <Picture 1> while nothing was actually encoded. vl_crop and vl_upscale control that copy; bicubic and area beat lanczos when you're shrinking.
There's also a mask input, and it's a trap of the honest kind: H3-Image has no per-pixel denoise mask in its packed layout, so the encoder prints a warning and ignores it.
Outputs are configs (the chain - wire into EditTextEncode_EditUtils) and config (this one image's entry, for chaining into the next preparer or a bbox-style node).
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/lrzjason/ComfyUI-EditUtils
# restart
Or search ComfyUI-EditUtils in ComfyUI Manager. No pip dependencies - the pack has no requirements file and relies on ComfyUI core, which also means you need a build new enough to know about minimax_h3_image and the minimax CLIP type. Models are heavy: a pruned w4a8 UNET, a 32B Qwen3-VL text encoder, and the H3I fp16 VAE. Start from the pack's workflows/minimax h3 image editutils example.json.
Common issues
Your result looks like a poster. Check the encoder's console line: it prints the target size and tells you when it's under ~3.5 MP. At scale_up=1.0 a 1 MP reference produces a 1 MP target, and that's the artifact. Raise scale_up on the main image.
Second reference did nothing. Either you didn't chain configs, or both preparers have ref_main_image on and one silently lost. Main is one image; the rest are references.
Padding crept in that you didn't ask for. ref_crop defaults to disabled, so padding only shows up if you switched it on - or if a mask mismatch printed a skip line and you assumed the mask path was active.
Inputs (17)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| configsopt | LIST | Configs list | |
| to_refopt | BOOLEAN | true | Encode the image as a reference latent (minimax_refs). Keep on: H3I edits are driven by these latents. |
| ref_main_imageopt | BOOLEAN | true | This image is the picture to edit: its latent supplies the target grid. Only the first one in the chain wins. |
| ref_short_edgeopt | INT | 102432–4096 | Short edge of the reference latent AND of the vision copy. ComfyUI uses 1024 for references. |
| ref_max_short_edgeopt | INT | 204832–8192 | Upper clamp for the reference short edge (ComfyUI: 2048). Bigger references are only downscaled to this. |
| scale_upopt | FLOAT | 1.001–4 | Main image only: final latent size = this image's reference size x scale_up. H3I needs 4-20 MP, references are happiest at ~1 MP, so 2.0 turns a 1 MP main reference into a ~4 MP target without upscaling the reference itself. |
| ref_cropopt | COMBO | disabled | disabled = ComfyUI's reference behaviour (aspect-preserving resize, no crop). center = minimal center crop; pad = fill to a 32 px canvas. |
| ref_upscaleopt | COMBO | lanczos | Resize filter for the reference image |
| to_vlopt | BOOLEAN | true | Give the reference to the Qwen3-VL text encoder as "Picture n: " + vision block. Keep on for the trained edit recipe. |
| vl_cropopt | COMBO | disabled | Crop mode for the vision copy (disabled matches ComfyUI) |
| vl_upscaleopt | COMBO | bicubic | Resize filter for the vision copy; bicubic/area beat 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 matches the H3I reference padding |
| pad_color_rgbopt | STRING | - | Optional override: 6-digit hex color, with or without '#' (e.g. FF0000). When valid it overrides pad_color; anything else is ignored |
| pad_noiseopt | FLOAT | 0.000–0.2 | Gaussian jitter (std) added to the pad area only; 0.02-0.05 recommended with solid colors |
| maskopt | MASK | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| configs | LIST | — |
| config | ANY | — |