MiniMax H3 Ratio from Image (ZeroHackz)
Keep your reference image's exact ratio in MiniMax H3
- image
- width
- height
- length
- info
The other node in the ZeroHackz ResolutionSelector pack solves the problem its sibling deliberately ignores. ResolutionSelectorZerohackz gives you a 16:9 table - great when you're generating from a prompt, useless when your workflow is image-to-video and you want H3 to respect the reference image's framing. Feed it a 2.39:1 cinemascope still or a portrait phone shot, and a forced 16:9 canvas crops or letterboxes the very composition you asked the model to animate.
MiniMax H3 Ratio from Image (ZeroHackz) is the fix: you wire in the image, it measures the actual aspect ratio, and it hands back width and height that preserve that ratio - still multiples of 32 (H3's canvas constraint) and still under the ~2 megapixel cap the model is happy at. Same family, same author, same tiny MIT pack. No API, no key, no model files of its own.
How it works
The node reads the dimensions straight off the IMAGE tensor you feed it (image.shape), floors each side down to the nearest multiple of 32, then reduces the ratio to its irreducible unit pair. From there it enumerates every integer scale of that unit that stays at or below 2 megapixels, producing a short list of candidates that get bigger as they go.
The key word in that sentence is "candidate." The scale_stop slider doesn't directly set a resolution - it picks an index into that computed list, and the code clamps it into range, so you can't overshoot past what fits under 2 MP. The slider's 0–512 range is far more generous than the real list (a typical image yields a handful of scales), and everything past the end just lands on the biggest legal option. Set it once, and what you're really choosing is "small, medium, or big version of my image's exact ratio."
Inputs and outputs that matter
Three inputs, and honestly only two need your attention:
- image - an
IMAGE, so wire in any loaded image or anything upstream that emits frames. No image, no ratio to measure. - scale_stop - the slider above. Default 0 is the smallest scale; crank it for the biggest that fits.
- duration - seconds, 2–30, default 5, handled exactly like its sibling: multiplied by 24 fps and snapped up onto H3's frame grid (
length % 17 == 5). Keep it in the ~4–15 s envelope the model actually targets.
Outputs are width, height, length, and a STRING called info - the genuinely nice extra. It's a formatted dump of the source resolution, the number of available scales, and every candidate with its megapixel count, marked [original] when it matches your source and ◄ current for the selected one. Wire it into a text display node and you can see exactly what the slider is doing instead of guessing.
Then it's the same ending as its sibling: convert the width/height/length widgets on MiniMaxH3ImageToVideo to inputs (right-click → Convert widget to input) and wire these three integers in.
Install and gotchas
Same pack, same steps:
cd ComfyUI/custom_nodes
git clone https://github.com/ZeroHackz/ComfyUI-ResolutionSelector
Restart, and it appears under MiniMax H3/ZeroHackz next to the resolution picker. It's not in ComfyUI-Manager's registry yet, so the clone is the way. No dependencies beyond what ComfyUI ships.
Two things that catch people. First, this node needs a real image upstream - you can't just type a resolution into it, so if you're at the start of a brand-new graph you'll reach for the 16:9 sibling instead. Second, there's no orientation widget because there doesn't need to be: the image decides. Portrait reference in, portrait dimensions out, and your composition survives intact. That's the whole point of reaching for this one over its table-driven brother.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Source image whose ratio is preserved. | |
| scale_stop | INT | 00–512 | Pick a scale from the menu (all ≤ 2 MP). Higher = bigger. Clamped to available scales. |
| duration | INT | 52–30 | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |
| length | INT | — |
| info | STRING | — |