OdinSam ResolutionEmptyLatent
Empty latent from aspect ratio and megapixels. Outputs a LATENT sized for SD, Flux, Qwen, or Flux 2.
Features
Seven widgets, in this order.
| # | Widget | Notes |
|---|--------|--------|
| 1 | Latent type | SD / Flux / Qwen / Flux2 |
| 2 | Aspect ratio | 自定义 (custom) is first. 16:9 means width 16, height 9 |
| 3 | Width | Editable on every aspect ratio |
| 4 | Height | Editable on every aspect ratio |
| 5 | Megapixels | 1.0 = 1,000,000 pixels. Default 1.0, range 0.01–16 |
| 6 | Multiple | Typed integer. Default 16. Changing it writes the aligned width and height. 1 skips the multiple snap |
| 7 | Batch size | Default 1 |
The only output is LATENT.
Sizing
- The queued latent uses width and height, then snaps to the multiple and the latent stride.
- Changing the aspect ratio to a preset recomputes width and height from that ratio and the megapixel count, then writes them back.
- Changing megapixels recomputes the area from the aspect ratio and writes width and height. A preset uses that ratio. Custom uses the current width/height ratio.
- Changing the multiple does not retarget the area. It aligns the current width and height and writes them back.
- The multiple only shrinks or crops the remainder, never enlarges. If the short side is shorter than one step, that pass keeps the original sides.
1skips it. - Before writing back, sides are also floored to the latent stride (8 or 16).
Defaults: SD, 自定义, width and height 1024, 1.0 megapixel, multiple 16. Width, height, megapixels, and multiple can be typed immediately.
Latent types
| Type | Channels | Divide pixels by | Models | |------|----------|-------------------|--------| | SD | 4 | 8 | SD, SDXL | | Flux | 16 | 8 | Flux.1 | | Qwen | 16 | 8 | Qwen Image (first generation). Same shape as Flux | | Flux2 | 128 | 16 | Flux 2, Flux 3 |
Z-Image uses the same empty latent shape as Flux / Qwen. Qwen Image 2.1 (64 channels, stride 16) is not in this node.
OdinSamKit
The latent does not depend on KIT. Without it, web/resolution_empty_latent.js still applies Chinese labels and writes width and height when megapixels or the multiple change.
| Item | Requirement | |------|-------------| | Minimum KIT | OdinSamKit ≥ 0.2.0 | | Relationship | Optional (Chinese labels) |
Nothing is hidden. All eight widgets stay on the node.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/odinGitGmail/ComfyUI-Odinsam-ResolutionEmptyLatent.git ResolutionEmptyLatent
Restart ComfyUI. Registry / Manager id: odinsam-resolution-empty-latent.
Menu: 分辨率空Latent (OdinSam) (category OdinSam/ResolutionEmptyLatent).
Minimal graph
this node Latent → [KSampler] latent_image
Match the latent type to the model: SD for SD, Flux for Flux.1, Flux2 for Flux 2.