ZML_预设分辨率
Pick a resolution from a dropdown
- 宽
- 高
- latent
ZML_预设分辨率 is a dropdown full of named resolutions that spits out a width, a height, and a ready-made empty latent - one node instead of three. The preset list is the standard SDXL-friendly spread (768x1344 through 1024x1024 and everything in between), which is exactly the set the author keeps on hand for their Wan img2video work, and the latent output is the part that saves you a step.
The mechanism is unglamorous and that's the appeal: the node reads a plain text file at zml_w/txt/Preset integer/Preset integer.txt, one resolution per line. Lines can be W,H or Name_W,H - anything starting with # is a comment. Add your own line, restart (or re-open the node) and your custom resolution appears in the dropdown. The latent is a zero-filled [batch, 4, H//8, W//8] tensor, sized to whatever you picked, so it plugs straight into a sampler.
The controls
- 预设 - the dropdown. 23 SDXL presets out of the box.
- 互换宽高 - BOOLEAN. Swap width and height (handy for portrait↔landscape flips).
- 随机模式 - BOOLEAN. When on, each run picks a random preset from the list instead of your selection.
- 批次数量 - INT, 1–100, default 1. Latent batch size.
Outputs: 宽 (INT), 高 (INT), latent (LATENT). Wire 宽/高 into an empty-latent-free sampler or an image-size-dependent node, and the latent into the sampler directly.
Why it beats typing
Three real wins. One: no more forgetting whether your Wan setup wants 832x1216 or 1216x832 - it's a named option. Two: the latent output means you don't need a separate Empty Latent Image node at all. Three: random mode + swap makes it a cheap resolution-augmentation toy for testing - the author added it specifically so they'd stop forgetting to vary resolution on video work. There's even a IS_CHANGED hook so random mode re-rolls every run while non-random mode stays cache-friendly.
The 2025.10.31 changelog fixes a real gotcha: earlier versions re-rolled the latent on every run even with random mode off. That's fixed - with random mode off you now get a stable, cached result. If you're on an old install and see latents changing between runs for no reason, update the pack.
Install
Part of ComfyUI-ZML-Image. Manager → search ComfyUI-ZML-Image, or:
cd ComfyUI/custom_nodes
git clone https://github.com/zml-w/ComfyUI-ZML-Image
restart. No models, no extra deps. English users: the README's translation patch is worth installing since the UI and presets are Chinese-first. If you add custom resolutions, keep the file format exact (Name_W,H or W,H, no spaces around the comma) - lines that don't parse are silently skipped with a warning in the console.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| 预设 | COMBO | SDXL_768x1344 | 23 options: SDXL_768x1344, SDXL_768x1280, SDXL_832x1216, SDXL_832x1152, SDXL_896x1152, SDXL_896x1008, +17 |
| 互换宽高opt | BOOLEAN | false | — |
| 随机模式opt | BOOLEAN | false | — |
| 批次数量opt | INT | 11–100 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| 宽 | INT | — |
| 高 | INT | — |
| latent | LATENT | — |