Width/Height Literal
A dimension source for the latent and the metadata
- INT
Width/Height Literal is an integer box tuned for image dimensions: it outputs an INT, but its range and step are set up for pixel sizes rather than arbitrary numbers. Like the rest of the pack's little literal nodes, its point is to be one source of truth. Set your width once, wire it into both the Empty Latent Image node that sizes the generation and the Save Image w/Metadata node's width, and the dimension recorded in the file is the dimension that was actually rendered. Do the same with a second one for height.
How it works
It's a single number widget with one INT output. You use two instances - one for width, one for height - because each outputs a single value. Feed each into the matching field on your Empty Latent Image (or whatever's setting your canvas size), and split each wire into the save node's width and height. The reason it's a separate node from the plain Int Literal is the constraints baked in: it snaps in steps of 8 and allows the large sizes real workflows use, which keeps you from accidentally feeding the sampler a dimension the model can't handle.
The input and output
- int (
INT, default512, range1-16384, step8) - the dimension in pixels. The step of8matters: Stable Diffusion's latent space downsamples by 8, so widths and heights want to be multiples of 8 (SDXL and later are happiest at multiples of 64).512is the SD 1.5 default; you'll usually set1024-ish for SDXL and modern models.
The single output is INT - the dimension.
Installing it
Bundled with the pack. ComfyUI Manager: search Save Image with Generation Metadata, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/giriss/comfy-image-saver
cd comfy-image-saver
pip install -r requirements.txt
Restart ComfyUI. No models needed.
Where people get tripped up
The usual wiring note: the dimension fields on Empty Latent Image are widgets, so convert them to inputs before you can connect this. Nothing exotic.
The dimension gotcha is more about the model than the node. The generous 16384 ceiling here does not mean the model can generate at 16k - push native resolution far past what a checkpoint was trained for (512 for SD 1.5, ~1024 for SDXL) and you get duplicated limbs, repeated heads and mangled composition, not a bigger clean image. For large final sizes you generate at the model's native resolution and upscale afterward; this node just sets the base dimensions and makes sure they land in your metadata correctly. And since each instance outputs one number, remember you need two - a single Width/Height Literal wired into both width and height gives you a square, which is sometimes what you want and often not.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| int | INT | 5121–16384 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |