Nodes/DiffusionGemma Prompt Builder/DiffusionGemma H3 Reference Pair Prep
ComfyUI Node

DiffusionGemma H3 Reference Pair Prep

Resize two H3 references fairly, without merging them onto one identity sheet

By exportAnything·Created 2 months ago·Updated a day ago· 44
DiffusionGemma H3 Reference Pair Prep
  • reference_image_1
  • reference_image_2
  • reference_image_1
  • reference_image_2
  • prep_metadata_json
  • reference_1_width
  • reference_1_height
  • reference_2_width
  • reference_2_height
  • combined_reference_megapixels
  • estimated_packed_reference_rows
generation_width1376
generation_height768
combined_reference_area_ratio1.00
reference_1_share0.60

Ref2VA workflows usually start with two reference images - a subject shot and an environment/style shot - and those two images are rarely the same size. Feed H3 one 4K hero and one 512px moodboard and the smaller one gets upscaled poorly or the bigger one dominates conditioning. DiffusionGemma H3 Reference Pair Prep is the small, focused utility that fixes exactly this: it keeps two references on separate sockets (so they stay separate semantic assets) while sharing one downscale-only pixel budget between them.

Notice the careful wording there. It never crops, pads, stretches, upscales, or batches - it downscales each image proportionally so neither one's framing or manifest order changes. That's the whole job, and it's the same reasoning the pack applies across its reference-prep layer: preserve source aspect, spend pixels where the identity lives, and never merge performer references into one contact sheet.

Inputs and outputs that matter

  • reference_image_1 / reference_image_2 - the images destined for MiniMax H3's ref_image_0/ref_image_1 (<Picture 1>/<Picture 2>). Keep this socket order aligned with the Director manifest.
  • generation_width / generation_height - connect the same values MiniMax H3 is generating at. They define the shared reference budget, not a crop or an output-video resize. Typical H3 numbers are ~1376×768.
  • combined_reference_area_ratio - the combined pixel budget for both references as a fraction of one generated frame. 1.0 (default) lets both together use up to about one frame's pixel area; 0.5 is a more aggressive, faster reference cap.
  • reference_1_share - 0.60 default favors the Picture 1 identity image; any allocation Picture 1 can't use is automatically reassigned to Picture 2, and vice versa.

Outputs keep the two images on their own wires (reference_image_1/reference_image_2), still each with its own aspect ratio, plus prep_metadata_json, the resulting reference_1_width/height and reference_2_width/height, combined_reference_megapixels, and estimated_packed_reference_rows for downstream H3 packing.

Wiring

The README's canonical hookup, for two differently sized pictures before the native reference sockets:

Picture 1 ---------------------> reference_image_1
Picture 2 ---------------------> reference_image_2
JSON Splitter width/height ----> generation_width/generation_height

reference_image_1 output ------> MiniMax H3 ref_image_0 / <Picture 1>
reference_image_2 output ------> MiniMax H3 ref_image_1 / <Picture 2>

Keep MiniMaxH3ReferenceToVideo.ref_image_size=match. The node lives under prompt/diffusiongemma/optional.

Set expectations

The honest caveat, straight from the README: reference resizing is not a substitute for reducing the main H3 workload. Resolution, frame count, and sampler steps dominate render time, not reference prep. This node affects only H3 image-reference conditioning - it doesn't resize the generated video, shorten its duration, or cut sampler steps. If a render is too slow, fix the real workload first.

Installing it

Part of the exportAnything/ComfyUI-DiffusionGemmaPromptBuilder pack:

cd ComfyUI/custom_nodes
git clone https://github.com/exportAnything/ComfyUI-DiffusionGemmaPromptBuilder

or search DiffusionGemma Prompt Builder in ComfyUI Manager and restart. Pure image-prep logic - no extra model, no extra VRAM beyond a single decode. The DiffusionGemma model folder (ComfyUI/models/LLM/diffusiongemma-26B-A4B-it-NVFP4) matters only when you reach the Director half of the graph.

Common issues

  • References come out looking squashed or cropped anyway. That means something else in your chain is resizing them - this node never stretches. Check for an upstream resize/upscale node or a wrong ref_image_size on the H3 node.
  • Dimensions you didn't expect. The width/height outputs reflect the shared budget math, not the original files. If Picture 1's identity fidelity is dropping, raise reference_1_share - and remember combined_reference_area_ratio below ~0.5 starts costing identity/style fidelity.
  • Sizes drifting from the generator. If you didn't wire the splitter's width/height into generation_width/height, the budget is computed against the wrong frame, and H3's actual generation size won't match your prep numbers. Keep them the same value.
Categoryprompt/diffusiongemma/optional

Inputs (6)

NameTypeDefaultDescription
reference_image_1IMAGEThe image connected to MiniMax H3 ref_image_0 / <Picture 1>. Keep this socket order aligned with the Director manifest.
reference_image_2IMAGEThe image connected to MiniMax H3 ref_image_1 / <Picture 2>. The two outputs remain separate and keep their own aspect ratios.
generation_widthINT1376256–8192Connect the same width used by MiniMax H3. It defines the shared reference budget, not a crop or output-video resize.
generation_heightINT768256–8192Connect the same height used by MiniMax H3.
combined_reference_area_ratioFLOAT1.000.25–2Total pixel budget for both images divided by one generation frame. 1.0 shares one frame's pixel area across both references; 0.5 is faster but may reduce identity/style fidelity.
reference_1_shareFLOAT0.600.1–0.9Preferred share of the combined budget for Picture 1. Any allocation that Picture 1 cannot use is automatically reassigned to Picture 2, and vice versa.

Outputs (9)

NameTypeDescription
reference_image_1IMAGE
reference_image_2IMAGE
prep_metadata_jsonSTRING
reference_1_widthINT
reference_1_heightINT
reference_2_widthINT
reference_2_heightINT
combined_reference_megapixelsFLOAT
estimated_packed_reference_rowsINT