Nodes/AntiMatter Nodes/Anti_aspect_ratio_master
ComfyUI Node

Anti_aspect_ratio_master

An empty latent that already speaks Flux

By AntiMatterComfy·Created 3 months ago·Updated 27 days ago· 0
Anti_aspect_ratio_master
  • image
  • latent
  • width
  • height
  • final_preset
  • image_name
sourcefrom_preset
preset832x1216
manual_width0
manual_height0
round_to64
orientationauto
batch_size1
latent_channels16
downsample_factor8

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, or swap) - 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, or from_image. from_image grabs 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 like 832x1216, 1024x1024, 1216x1664. The default, 832x1216, is a solid portrait start for Flux.
  • manual_width / manual_height: your own dimensions when source is from_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.

CategoryAntiMatter/Image

Inputs (10)

NameTypeDefaultDescription
sourceCOMBOfrom_preset3 options: from_preset, from_manual, from_image
presetCOMBO832x121616 options: 832x1216, 896x1152, 960x1344, 1024x1024, 1024x1536, 1152x896, +10
manual_widthINT00–8192
manual_heightINT00–8192
round_toINT641–256
orientationCOMBOauto4 options: auto, portrait, landscape, swap
batch_sizeINT11–64
latent_channelsINT161–64
imageoptIMAGE
downsample_factoroptINT81–16

Outputs (5)

NameTypeDescription
latentLATENT
widthINT
heightINT
final_presetSTRING
image_nameSTRING