Runware Resolution Calculator
A resolution picker for Nano Banana 2 that actually looks at your image
- full_image
- cropped_image
- mask
- width
- height
Nano Banana 2 is a Runware-hosted, API-based image model - the kind of closed cloud model that's genuinely good with multiple reference images, but expects its output at one of a specific set of preset resolutions. Picking the right preset by eye is exactly the kind of boring chore that makes you reach for a node. Runware Resolution Calculator does the picking: feed it your image, optionally a mask, and it returns width and height integers chosen from the model's preset list.
First, the thing that needs saying: the name is a lie in one direction. This node doesn't call any API, needs no key, and never sends your image anywhere. It's pure local math that outputs two integers. It's a calculator, not an API client - you wire the numbers it produces into whatever actually talks to Runware (or any sampler that accepts explicit width and height).
How it works
The node carries a hardcoded PRESETS list for "Nano Banana 2": squares, 3:2 and 2:3, 5:4 and 4:5, ultrawide, and cinematic ratios - the resolutions the model family supports. Then it picks, and the picking is where it gets interesting:
- Direct mode (image only): candidates are first filtered to those that fit inside your source dimensions, then scored on log-scale aspect-ratio distance, area utilization (how much of the source's area the target captures), an aspect-bucket bonus, and a quality tier. The highest composite score wins.
- Mask mode (image + mask): it finds the mask's bounding box (your region of interest), then tries three fitting strategies - width-anchored, height-anchored, and proportional - and scores them with a harmonic mean of expansion efficiency and scale match. This is the clever part: a portrait subject in a landscape frame gets a portrait preset, not a squished landscape.
It prints its reasoning to the console (✓ Selected: 896×1200 (expansion: 2.15x)), which is nice for understanding why it picked what it picked.
Inputs and output
full_image- IMAGE, required. The source you're matching against.model_preset- dropdown; today the only entry is "Nano Banana 2". The presets are model-specific, so this list will grow as presets get added.cropped_image- optional IMAGE.mask- optional MASK; providing one switches the node into ROI-constrained mode.- Outputs:
widthandheight- INT. Wire them into whatever consumes explicit dimensions.
Where people get burned
If nothing in the preset list fits inside your source (or the mask is empty), it falls back to 1024×1024 rather than erroring - watch the console for the warning, because a silent square fallback on a 16:9 image is confusing. And the preset list is hardcoded in the node, so if Runware adds new supported resolutions, this node needs an update to see them. It computes numbers for the one preset it knows; treat it as a helper for the "which resolution" decision, not a resolution oracle.
Install
Same as every node in this pack: ComfyUI Manager → search "uber_comfy_nodes" ("Suplex Misc ComfyUI Nodes") → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/saftle/uber_comfy_nodes
Restart, find it under Uber Comfy. Requirements are Pillow, numpy, psutil and pynvml - nothing heavy, and again: no API key involved.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| full_image | IMAGE | — | |
| model_preset | COMBO | Nano Banana 2 | 1 options: Nano Banana 2 |
| cropped_imageopt | IMAGE | — | |
| maskopt | MASK | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |