feat: extend the preset list down to 0.15 MP

The floor sat at 0.25 MP, so 16:9's cheapest entry was 768x432 — and that
one is K2-only (432 % 32 = 16), leaving 1024x576 as the smallest H3-legal
16:9 in the list. An audio-only H3 render wants 512x288, the n=1 lattice
point at alignment 32, where the video canvas is pure overhead.

Dropping PRESET_MIN_MP alone re-picks the geometric thinning and silently
drops labels — 3:2 1152x768 and 1920x1280 among them — which breaks saved
workflows, since the label string is what a graph stores. Raising
PRESET_MAX_ENTRIES to 11 in the same step absorbs that: 79 -> 87 entries
with every existing label still present and still pointing at the same
size. The six entries beyond 512x288 / 288x512 are lattice points the old
9-entry cap had been skipping over.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1sGVWw5KU3GD7CrhdZR7M
This commit is contained in:
dreevelle
2026-09-13 00:36:42 +01:00
co-authored by Claude Opus 5
parent 544116c778
commit 03ca33cb78
3 changed files with 13 additions and 6 deletions
+5 -1
View File
@@ -390,7 +390,7 @@ the useful rows are all still there (1024×576, 1536×864, 2048×1152, 2560×144
### Resolution Preset
One combo of 79 known-good resolutions. Every entry is exactly on its aspect ratio and
One combo of 87 known-good resolutions. Every entry is exactly on its aspect ratio and
on the patch grid, so there is nothing to compute and nothing to look up.
**Inputs** — `preset`, formatted `ratio · width × height · real MP · compatible models`.
@@ -412,6 +412,10 @@ entries, and the coarse grid lands them on canonical sizes — 512, 768, 1024, 1
— instead. Coarse-lattice ratios like 16:9 fall through to grid 16 and keep their full
useful set.
The list spans 0.15 to 4.3 MP. The bottom end is there for runs where the canvas is
overhead rather than output — an audio-only MiniMax H3 render, say, where `16:9 · 512 ×
288` is the smallest exact 16:9 the model's 32 px grid admits.
Why a list and not a number: with `exact_ratio` on, the valid outputs *are* a discrete
lattice. A continuous megapixel input advertises precision that does not exist, and
pushes the lookup table out of the node and into your head (or a sticky note next to
+7 -4
View File
@@ -55,7 +55,7 @@ from typing_extensions import override
from comfy_api.latest import ComfyExtension, IO
__version__ = "1.1.1"
__version__ = "1.2.0"
# ---------------------------------------------------------------------------
@@ -157,10 +157,13 @@ def align_value(value: int, alignment: int, mode: str) -> int:
# presets are the lattice, rendered readable -- derived at import time, never
# hand-maintained, so they cannot drift from what the solver produces.
# ---------------------------------------------------------------------------
PRESET_MIN_MP = 0.25
# The floor sits just under 512x288 (0.147 MP), the n=1 lattice point for 16:9
# at alignment 32 -- the smallest exact 16:9 an H3 graph can ask for. Useful for
# audio-only H3 runs, where the video canvas is pure overhead.
PRESET_MIN_MP = 0.14
PRESET_MAX_MP = 4.3
PRESET_MIN_ENTRIES = 6 # coarsest grid that still offers this many sizes wins
PRESET_MAX_ENTRIES = 9 # thin geometrically beyond this, keeping both ends
PRESET_MIN_ENTRIES = 6 # coarsest grid that still offers this many sizes wins
PRESET_MAX_ENTRIES = 11 # thin geometrically beyond this, keeping both ends
# 16:9 and 9:16 lead: the common case for video and for delivery to a screen.
PRESET_RATIO_ORDER = [
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui-resolution-tools"
description = "Resolution maths for latent-space models, done exactly. Real megapixels (10^6, not 1024^2), patch-grid alignment for Krea 2 / MiniMax H3 / Flux / SDXL, and aspect ratios held exact instead of drifting on rounding."
version = "1.1.1"
version = "1.2.0"
license = { file = "LICENSE" }
readme = "README.md"
requires-python = ">=3.10"