Nodes/ComfyUI-EditUtils/EditUtils: Minimax H3 Image Config Preparer lrzjason
ComfyUI Node

EditUtils: Minimax H3 Image Config Preparer lrzjason

The H3I sizing node explained

By lrzjason·Created 11 months ago·Updated 15 days ago· 271
EditUtils: Minimax H3 Image Config Preparer lrzjason
  • image
  • configs
  • mask
  • configs
  • config
◄to_reftrue►
◄ref_main_imagetrue►
◄ref_short_edge1024►
◄ref_max_short_edge2048►
◄scale_up1.00►
◄ref_cropdisabled►
◄ref_upscalelanczos►
◄to_vltrue►
◄vl_cropdisabled►
◄vl_upscalebicubic►
◄pad_modecolor►
◄pad_colorblack►
◄pad_color_rgb-►
◄pad_noise0.00►

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=1024 with scale_up=2 gives 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.

Categoryadvanced/conditioning

Inputs (17)

NameTypeDefaultDescription
imageIMAGE—
configsoptLISTConfigs list
to_refoptBOOLEANtrueEncode the image as a reference latent (minimax_refs). Keep on: H3I edits are driven by these latents.
ref_main_imageoptBOOLEANtrueThis image is the picture to edit: its latent supplies the target grid. Only the first one in the chain wins.
ref_short_edgeoptINT102432–4096Short edge of the reference latent AND of the vision copy. ComfyUI uses 1024 for references.
ref_max_short_edgeoptINT204832–8192Upper clamp for the reference short edge (ComfyUI: 2048). Bigger references are only downscaled to this.
scale_upoptFLOAT1.001–4Main 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_cropoptCOMBOdisableddisabled = ComfyUI's reference behaviour (aspect-preserving resize, no crop). center = minimal center crop; pad = fill to a 32 px canvas.
ref_upscaleoptCOMBOlanczosResize filter for the reference image
to_vloptBOOLEANtrueGive the reference to the Qwen3-VL text encoder as "Picture n: " + vision block. Keep on for the trained edit recipe.
vl_cropoptCOMBOdisabledCrop mode for the vision copy (disabled matches ComfyUI)
vl_upscaleoptCOMBObicubicResize filter for the vision copy; bicubic/area beat lanczos when downscaling
pad_modeoptCOMBOcolorHow to fill the padding area when ref_crop == pad
pad_coloroptCOMBOblackPad fill color when pad_mode == color; black matches the H3I reference padding
pad_color_rgboptSTRING-Optional override: 6-digit hex color, with or without '#' (e.g. FF0000). When valid it overrides pad_color; anything else is ignored
pad_noiseoptFLOAT0.000–0.2Gaussian jitter (std) added to the pad area only; 0.02-0.05 recommended with solid colors
maskoptMASK—

Outputs (2)

NameTypeDescription
configsLIST—
configANY—