π§ AspectRatio (Dehypnotic)
AspectRatio (Dehypnotic) does the math for you
- image
- vae
- width
- height
- latent
- scaled_image
Every model has resolutions it actually likes, and the ones it doesn't are how you get double heads and stretched bodies. SDXL wants its handful of trained ratios around 1024px; Flux wants multiples of 64. Hand-typing "1344x768" into an Empty Latent node every time is exactly where beginners make the mistake that produces garbage - and this node exists so you stop doing that arithmetic in your head. π§ AspectRatio (Dehypnotic) is a resolution calculator and scaler with a real UI, no inputs you have to fill in, and a latent output you can drop straight into a KSampler.
What it actually does
It's one node that replaces the fiddly "calculate width from aspect ratio, keep it divisible by 8, punch it into EmptyLatentImage" dance. You pick a ratio and a target, it hands you four outputs: width and height (INT), a ready-to-sample latent (LATENT), and a scaled_image (IMAGE). No required inputs at all - everything is driven by the node's own panel. The whole thing is a custom frontend with four tabs - Presets, Custom Ratio, Custom Dims, Processing - and all your settings live in a hidden JSON state string on the node, which is why the node has no scary rows of widgets when you add it.
The three modes that matter
- Presets - 1:1, 4:3, 3:2, 16:9, 21:9, 3:4, 2:3, 9:16, 9:21, 4:5, 5:7. Pick one, then say whether your number (default 1024) is the min side, max side, or target megapixels.
- Custom Ratio - type your own ratio like 7:4, or attach an image and it grabs the image's ratio for you.
- Custom Dims - exact width/height, or again "use the attached image".
Under the hood it's straightforward math: min-side means "shortest edge equals this", max-side means "longest edge equals this", megapixels solves wΓh = target. Then it snaps - rounds both dimensions to the nearest multiple of your snap value (8/16/32/64, default 16) and clamps between 64 and 8192. That snap step is the real feature: latent space runs at 8Γ8 pixels per latent, so a non-multiple-of-8 size is a hard error or silent corruption. The latent output comes back pre-sized (h/8 Γ w/8 channels) ready for the KSampler.
The image half
Connect an image and you get the option of scaling it in the Processing tab. In "auto" it uses Lanczos when shrinking and bicubic when growing - sensible defaults, no sharpening to tune. The vae input is the clever bit: tick VAE encode and the scaled image comes out as a latent instead of the empty one, which makes this node a compact img2img front door. Attach image + VAE, set a ratio and a target size, and the "use reference" nodes do the rest. Note the scaled_image output is a dummy 64Γ64 zero tensor when nothing's connected, so don't wire it into a save node expecting a photo.
Installing
It's a one-commit, zero-dependency pack - no requirements.txt, no models to download, nothing but torch/PIL/numpy that ComfyUI already ships. ComfyUI Manager β search "Aspect Ratio Advanced" β install and restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Dehypnotic/comfyui-aspect-ratio-advanced.git
Then restart ComfyUI. One gotcha: the GitHub README describes an older version with batch_count, flip_dimensions and a resolution_info output that don't exist in the shipped node - the v2 node only exposes image and vae and returns four outputs. If you load an old workflow with the AspectRatioAdvanced class you'll see it flagged "DEPRECATED - REPLACE"; swap in π§ AspectRatio (Dehypnotic) and re-pick your settings.
The honest verdict
It's a small, brand-new utility from a solo author, so don't expect tutorials in the wild yet. But the core value - sane aspect-ratio math plus a snap step plus an optional one-stop VAE encode - is genuinely handy, and the double-click-to-edit custom preset buttons are nicer than typing ratios. If you're tired of a calculator beside your ComfyUI window, this is a clean fix.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| imageopt | IMAGE | β | |
| vaeopt | VAE | β |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| width | INT | β |
| height | INT | β |
| latent | LATENT | β |
| scaled_image | IMAGE | β |