Anti_aspect_ratio_master
An empty latent that already speaks Flux
- image
- latent
- width
- height
- final_preset
- image_name
The built-in EmptyLatentImage is a trap if you work in Flux, Z-Image, or ERNIE. It hands you a 4-channel latent, which is correct for SDXL and quietly wrong for anything with a 16-channel VAE - and the wrong channel count doesn't give you a bad image, it gives you noise. Anti_aspect_ratio_master is the version of that node that already knows the models you actually use.
It's a single node from the AntiMatter Nodes pack that creates an empty latent three ways: from a preset, from manual dimensions, or from an input image. You set source, the node builds a zeroed latent shaped for your model, and it hands back the real width and height so downstream nodes don't have to guess.
How it works
The mechanism is simpler than the name suggests. Pick a source and the node resolves a pixel width × height, then:
- Rounds to
round_to(default 64). That matters because Flux wants dimensions divisible by 64 - generate off that and you get the stretched limbs and doubled anatomy people blame on the model. The other presets are the sizes Flux, Z-Image, and ERNIE actually like, so you rarely type numbers. - Applies
orientation(auto,portrait,landscape, orswap) - a handy way to flip a chosen preset without editing it. - Divides by
downsample_factor(default 8) to get latent dimensions, matching how a VAE compresses 8x per side. - Uses
latent_channels(default 16) for the latent's channel count - right for Flux and Z-Image, both of which use a 16-channel VAE.
The latent itself is a zero tensor, same idea as EmptyLatentImage, ready to feed a KSampler.
Inputs that matter
source:from_preset,from_manual, orfrom_image.from_imagegrabs dimensions off a connected image and is the one you want for img2img where you want the output to match the input.preset: 16 WxH presets like832x1216,1024x1024,1216x1664. The default,832x1216, is a solid portrait start for Flux.manual_width/manual_height: your own dimensions whensourceisfrom_manual.latent_channels: leave it at 16 unless you know better. Note that ERNIE's VAE is reported to be a 128-channel latent space, so if you run ERNIE you'd set this to match - a mismatch is the classic "everything comes out as colored static" failure.batch_size: how many blank latents to stack, for batch generation.
Outputs
latent wires into your KSampler. The rest exist so you don't have to hardcode sizes: width and height as integers, final_preset as a "WxH" string, and image_name (the filename of the input image when you used from_image). That image_name output is sneaky-useful for output filename templating.
Installing it
It ships in the AntiMatter Nodes pack - no separate download. Clone the repo into your custom nodes folder:
cd ComfyUI/custom_nodes
git clone https://github.com/AntiMatterComfy/antimatter-nodes.git
Restart ComfyUI. ComfyUI Manager may find it as "AntiMatter Nodes" if it's on the registry list; if not, the clone above is the reliable path. There are no extra Python dependencies and no model files - the pack's pyproject.toml ships with an empty dependency list, which is rarer than it should be in this ecosystem.
Where people get burned
The channel count one is the biggie - if your latent comes out as static, it's almost always latent_channels vs. your VAE, not the sampler. The other common miss: round_to doesn't force multiples of 8, so if you set it to something weird the latent division floors and you get off-by-one dimensions. Leave it at 64 and you won't think about it again.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| source | COMBO | from_preset | 3 options: from_preset, from_manual, from_image |
| preset | COMBO | 832x1216 | 16 options: 832x1216, 896x1152, 960x1344, 1024x1024, 1024x1536, 1152x896, +10 |
| manual_width | INT | 00–8192 | — |
| manual_height | INT | 00–8192 | — |
| round_to | INT | 641–256 | — |
| orientation | COMBO | auto | 4 options: auto, portrait, landscape, swap |
| batch_size | INT | 11–64 | — |
| latent_channels | INT | 161–64 | — |
| imageopt | IMAGE | — | |
| downsample_factoropt | INT | 81–16 | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |
| width | INT | — |
| height | INT | — |
| final_preset | STRING | — |
| image_name | STRING | — |