ZImage Resolution Picker is a utility node for ComfyUI that provides a curated list of commonly used resolutions and aspect ratios tailored for Z-Image image generation. It simplifies choosing valid width/height combinations by offering human-readable presets such as 1024×1024 (1:1), 1280×720 (16:9), 720×1280 (9:16), and more — helping you quickly configure your workflow without manual input.
Resolutions are based on known choices from the official Z-Image-Turbo interface code on HuggingFace Spaces and common community practices.
Download the archive, extract the folder, and copy it intoComfyUI/custom_nodes/. Restart ComfyUI to apply changes.
Description
FAQ
Comments (14)
One Minor Issue
The code is actually redundant. You have a standalone PICK function defined at the top of the file, and then the exact same logic is repeated inside the ZImageResolutionPicker class.
Additionally, the standalone pick function at the top would actually crash if called because it references self but is defined outside of a class. However, since ComfyUI calls the version inside the class, the node will work fine.
I slightly modified it, seems to work fine for me. Its below in comments.
import nodes
import re
RESOLUTION_LIST = [
"────────── 1024 ──────────",
"1024x1024 (1:1)", "1152x896 (9:7)", "896x1152 (7:9)", "1152x864 (4:3)", "864x1152 (3:4)",
"1248x832 (3:2)", "832x1248 (2:3)", "1280x720 (16:9)", "720x1280 (9:16)", "1344x576 (21:9)", "576x1344 (9:21)",
"────────── 1280 ──────────",
"1280x1280 (1:1)", "1440x1120 (9:7)", "1120x1440 (7:9)", "1472x1104 (4:3)", "1104x1472 (3:4)",
"1536x1024 (3:2)", "1024x1536 (2:3)", "1536x864 (16:9)", "864x1536 (9:16)", "1680x720 (21:9)", "720x1680 (9:21)",
"────────── 1536 ──────────",
"1536x1536 (1:1)", "1728x1344 (9:7)", "1344x1728 (7:9)", "1728x1296 (4:3)", "1296x1728 (3:4)",
"1872x1248 (3:2)", "1248x1872 (2:3)", "2048x1152 (16:9)", "1152x2048 (9:16)", "2016x864 (21:9)", "864x2016 (9:21)",
]
class ZImageResolutionPicker:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"resolution": (RESOLUTION_LIST,),
"batch_size": ("INT", {"default": 1, "min": 1, "max": 64}), # Increased max to 64
}
}
RETURN_TYPES = ("LATENT", "INT", "INT")
RETURN_NAMES = ("latent", "width", "height")
FUNCTION = "pick"
CATEGORY = "latent/z-image"
def pick(self, resolution, batch_size):
match = re.match(r"(\d+)x(\d+)", resolution)
if not match:
raise ValueError(f"Select a resolution, not the separator: {resolution}")
width, height = int(match.group(1)), int(match.group(2))
# Access ComfyUI's native EmptyLatentImage node
latent = nodes.EmptyLatentImage().generate(
width=width,
height=height,
batch_size=batch_size
)[0]
return (latent, width, height)
Thanks for the detailed review!
You’re absolutely right — the standalone pick function is unused and will be removed, and the missing match check inside the node method is a bug. I’ll push a fix shortly. Appreciate the careful feedback 🙏
@Krug_Lov this is really useful did you push the fix already ? i will maybe use it when it gonna be fixed :) wonderful job !
@EKKIVOK Yes, download version 1.2
@Krug_Lov yeah i downloaded it and it working but, for a IMG2IMG use is there a way to use it ? cause ....original img goes already on the latent sampler node wich is complicated cause your node use it too... is there a way to add an "image" link inside your node ? like that it will be possible to use it on img2img workflows, i will release several workflows and it will be nice to add this on my works :) an idead how to get it working with img2img ?
@Krug_Lov i found a way to get it working by adding a "image-scale" with it. but it will be interesting to get that kind of feature in your node itself :)
@EKKIVOK We need to think about a Resize Image analogue, but that would be a different node. It raises a lot of other issues with resolution, i.e., the resizing method and aspect ratio. That calls for a completely different node.
@Krug_Lov here is the thing if you add aspect resolution node from comfyui core it can work i already made it on my workflow and i added a "perfect res" node too and a switcher to let the user choose the custome ratio (yours) and the "find perfect resolution" node. by this way user will have the coice to use the original img ratio wich will be resized by any res he want but keeping the whole image as source OR your custom ratio, the result is incredible. and it works !!
@EKKIVOK Great!
thanks, very useful!
Friends, download version 1.2 with bug fixes! Enjoy!
More relevant choices over the picker I have been using. I would like to see this in the official comfy offerings.
Glad you liked it! These resolution presets are actually based on the official Z-Image (Alibaba Tongyi) implementation. I integrated them because they are specifically optimized for the model's architecture to ensure better composition and avoid artifacts at different aspect ratios. https://huggingface.co/spaces/Tongyi-MAI/Z-Image-Turbo/blob/main/app.py#L37
