Ino Megapixel Resolution
The resolution calculator with an MP budget
- width
- height
- aspect_ratio_x
- aspect_ratio_y
- aspect_ratio
Ask ten ComfyUI users what resolution to generate at and you'll get ten different aspect-ratio rituals. This node cuts through that by starting from the number that actually matters: megapixels. Pick a total pixel budget, pick an aspect ratio, and it computes width and height for you - rounded to a multiple you choose (16 by default, so the latent tensor stays friendly to the model). It's a tiny math node, but it removes the most fiddly arithmetic from workflow setup.
It's also a genuinely useful thinking tool these days. The old rules of "train at 512, generate at 1024" have loosened - most current models accept any resolution within a megapixel band, and the failure mode is soft degradation rather than broken anatomy. So "what megapixel budget fits my card and my model?" is the real question, and this node lets you answer it in one input.
How it works
Inputs:
megapixels- your total pixel budget (default 1.0; range 0.01–100).aspect_ratio- a dropdown of presets like "1:1 Square", or pick your own incustom_aspect_ratioasW:H(e.g.16:9). Ifcustom_aspect_ratiois filled with something parseable, it wins over the dropdown.divisible_by- rounds both dimensions up to a multiple of this (default 16; range 1–512).
Under the hood it solves width × height = MP × 1,000,000 with width/height = ar_x/ar_y, so both sides get clamped to at least divisible_by and rounded to the nearest multiple. Outputs: width and height (INT), plus aspect_ratio_x, aspect_ratio_y, and a aspect_ratio string (the resolved W:H), which are handy if you want to keep the ratio flowing through the graph as data rather than recomputing it.
Wire width/height into Ino Image Resize By Longer Side, an Empty Latent Image, or any resolution input - everything downstream just works.
Installing it
Ships with ComfyUI-InoNodes by nobandegani:
cd ComfyUI/custom_nodes
git clone https://github.com/nobandegani/comfyui_ino_nodes
cd comfyui_ino_nodes
pip install -r requirements.txt
Or search "ComfyUI Ino Nodes" in ComfyUI Manager and restart. V3 schema pack - keep ComfyUI updated.
Common issues
Not much to go wrong with pure math, but one habit saves pain: respect the model. 1.0 MP is a comfortable SDXL-era default, while bigger modern models can eat 2–4 MP happily - and the "megapixel band" idea only holds within the model's supported range, so don't expect 30 MP to be "more resolution" so much as "a memory explosion." Also check divisible_by: 16 is the standard for most architectures, but if you're targeting a specific model that wants 64, set it. A malformed custom_aspect_ratio silently falls back to the dropdown preset, which is forgiving but can confuse you if you typed something wrong - the resolved aspect_ratio output is there to show you what it actually used.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| megapixels | FLOAT | 1.000.01–100 | — |
| aspect_ratio | COMBO | 1:1 Square | 17 options: 1:1 Square, 9:16 Vertical Video, 16:9 Widescreen, 4:5 Social Media, 5:4 Classic Monitor, 3:4 Tablet, +11 |
| custom_aspect_ratio | STRING | — | |
| divisible_by | INT | 161–512 | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |
| aspect_ratio_x | INT | — |
| aspect_ratio_y | INT | — |
| aspect_ratio | STRING | — |