DiffusionGemma Reference Prep
Right-size your references before the Director reads them
- image
- image
- prep_metadata_json
- width
- height
- resolution_selector_preset
The DiffusionGemma "Director" nodes are a vision-language model reading your reference frames and writing the actual structured prompt for LTX, MiniMax H3, or whatever you're driving. Feed that model a 4K PNG and you're making it chew on pixels it only needs to describe. DiffusionGemma Reference Prep is the humble utility that right-sizes one image first - resize it, round it, hand it over. It sits under prompt/diffusiongemma/optional, which tells you everything about its ambition: it's the boring, correct bit of plumbing, not the star.
What it does
The node takes one IMAGE, optionally center-crops it to a target aspect ratio, then resizes it so the long edge lands where you want (default 1280, with the author's tooltip recommending about 1024–1536 for DiffusionGemma ingestion). Width and height get rounded to a multiple (default 8), which keeps the tensor aligned for the attention pipeline downstream.
The default aspect_policy is preserve_source - original framing survives, it only scales. Pick center_crop_to_target only when you deliberately want every reference standardized to one aspect ratio for comparison runs. And here's the trap that catches people: upscale_smaller_images is off by default, so a 512px thumbnail will not be blown up to 1280. That's intentional - upscaling adds zero information the model couldn't see at native size and wastes VRAM. Switch it on only when you need a fixed, larger analysis size for reproducibility.
The inputs and outputs that matter
You set three things: target_aspect_ratio (usually leave on source), long_edge, and multiple. That's it. The five outputs give you the resized image plus width, height, and a resolution_selector_preset string that matches the DiffusionGemma JSON Splitter's resolution presets - handy if you want the analysis size and the downstream generation size to stay in agreement. prep_metadata_json logs source dimensions, whether a crop happened, and the effective ratio for your records.
Wire the image output into the Context Hub (or a reference socket) wherever you'd previously connect the raw file. If you also keep the original around for actual conditioning, fine - this node only feeds the analysis copy.
Install
Install the whole pack once via ComfyUI Manager (search "DiffusionGemma Prompt Builder") or:
cd ComfyUI/custom_nodes
git clone https://github.com/exportAnything/ComfyUI-DiffusionGemmaPromptBuilder
then restart. The heavier story - the 26B NVFP4 DiffusionGemma model, the Blackwell-era VRAM floor - belongs to the Director nodes downstream. This prep node is a pure torch resize: it never loads the model, so it's usable the moment the pack imports.
Bottom line
Feed the Director clean, downscaled references and you'll get steadier analysis for free. It won't make your prompt better by itself - nothing here is magic - but it's the difference between the model reading your image and the model squinting at it.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| target_aspect_ratio | COMBO | source | 9 options: source, 1:1, 16:9, 9:16, 4:3, 3:4, +3 |
| aspect_policy | COMBO | preserve_source | preserve_source keeps the original framing and only scales by long edge. center_crop_to_target crops to the selected aspect ratio before resizing. |
| long_edge | INT | 1280256–4096 | Recommended practical range for DiffusionGemma image ingestion is about 1024-1536 on the long edge. |
| multiple | INT | 81–128 | Rounds output width and height to this multiple. |
| upscale_smaller_images | BOOLEAN | false | Off is the efficient default: images below the requested long edge are never enlarged. Enable only when you intentionally want a fixed larger Director-analysis size. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| prep_metadata_json | STRING | — |
| width | INT | — |
| height | INT | — |
| resolution_selector_preset | STRING | — |