Doom Resolution From MP
Doom Resolution From MP
- Width
- Height
- ActualMP
- AreaErrorMP
- AspectError
You know the feeling: you want a 16:9 image that isn't going to explode your VRAM, and you're manually typing numbers into an Empty Latent node, hoping 1280×720 times some multiplier lands on a multiple of 64. Doom Resolution From MP does that math for you - you give it a target in megapixels (or a long-side length), an aspect ratio, and a multiple, and it hands back clean Width and Height values plus error readouts telling you how far the rounding drifted from your target.
The reason this node exists is that modern models are picky about canvas size. Flux, LTX, and the video models all want dimensions that divide cleanly, and going off-multiple is how you get padding artifacts or silently worse quality. This node makes "staying on the rails" automatic.
How it works
Two modes:
- from_megapixels - pick a target like 1.0 MP, choose your aspect, and the node computes the closest W×H that hits that area.
- from_long_side - give it a long side (say 1024) and an aspect, and it sizes the short side to match.
Then the knobs that matter for real models: multiple (default 64 - the standard for Flux and LTX; SDXL-flavored work often wants 128), rounding (nearest / floor / ceil for how aggressively to snap to the multiple), and orientation (auto, or force landscape/portrait). There are also min_side/max_side limits and, for the custom aspect option, custom_ratio_w/custom_ratio_h to type your own proportions.
The inputs that matter
- mode - from_megapixels or from_long_side. Decide this first; it decides which other fields apply.
- megapixels - target area, when in from_megapixels mode.
- aspect_ratio - the presets (1:1, 4:3, 3:2, 16:9, 9:16, 2:3, 3:4) or
custom. - multiple - the divisibility constraint. 64 default is right for Flux/LTX; bump to 128 for SDXL-lineage.
- rounding - how the node resolves the inevitable "your aspect doesn't divide evenly" problem.
Outputs are Width and Height (the numbers you'll feed an Empty Latent or sampler), plus three honesty meters: ActualMP (what you actually got), AreaErrorMP (how far the area drifted from your target), and AspectError (how far the aspect drifted). Those last two are the interesting part - they tell you why a canvas came out slightly off, instead of leaving you to squint at the pixels.
Setup
Standard pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/PeterMikhai/Doom_Flux_NodePack
Restart ComfyUI, or search "DoomAI Nodes" in Manager. No dependencies - pure math.
Where people get burned
- The multiple is a constraint, not a suggestion. Set 64 and an aspect that fights it (like a weird custom ratio) and the node will happily produce a canvas that's a different area than you asked for - that's what
AreaErrorMPis reporting. If the drift matters, loosen the multiple or accept the nearest fit. - Different models want different multiples. 64 is Flux's standard, but LTX and some video models have their own preferences, and SDXL-lineage models often want 128. The default is a good starting point, not a universal truth.
- It computes; it doesn't generate. The outputs are integers - you still wire
Width/Heightinto an Empty Latent or your sampler's size inputs. This node won't fix a latent that ignores its inputs.
It's from the same small, Russian-authored pack as the rest of the Doom family - a utility node, unglamorous, no model downloads, no VRAM. But for anyone who's ever stared at a 1344×768 and wondered "is that even a valid Flux size?", it's the node that turns a guess into a number with an error bar attached.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | from_megapixels | from_megapixels — по целевым МП; from_long_side — по длинной стороне |
| megapixels | FLOAT | 1.000.01–500 | Целевые мегапиксели (при mode=from_megapixels) |
| aspect_ratio | COMBO | 1:1 | Аспект; custom — свои пропорции ниже |
| multiple | INT | 641–4096 | Кратность сторон (64 — стандарт для Flux/LTX) |
| roundingopt | COMBO | nearest | Округление до кратности: nearest / floor / ceil |
| orientationopt | COMBO | auto | auto — как задано аспектом; landscape/portrait — перевернуть при необходимости |
| custom_ratio_wopt | FLOAT | 1.000.01–1000 | Ширина пропорции при aspect_ratio=custom |
| custom_ratio_hopt | FLOAT | 1.000.01–1000 | Высота пропорции при aspect_ratio=custom |
| long_sideopt | INT | 10241–16384 | Длинная сторона (при mode=from_long_side) |
| min_sideopt | INT | 00–16384 | Мин. сторона (0 — без ограничения) |
| max_sideopt | INT | 00–16384 | Макс. сторона (0 — без ограничения) |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| Width | INT | Итоговая ширина |
| Height | INT | Итоговая высота |
| ActualMP | FLOAT | Фактические мегапиксели результата |
| AreaErrorMP | FLOAT | Ошибка площади в МП |
| AspectError | FLOAT | Ошибка аспекта |