GR Image Size
An EmptyLatentImage with 58 resolution presets and a random-size mode
- dimensions
- width
- height
- batch_size
- length
- samples
- seed
- empty_image
- resized
This is the "figure out my canvas size and give me a ready-to-go latent" node, and it does a lot more than the default EmptyLatentImage. Instead of just typing numbers, you can pick from 58 named presets covering classic SD resolutions ((SD) 512x512, (SD2) 512x768), portrait/landscape variants, and plain pixel dimensions - or go custom and type your own, or go random and let it pick something within bounds you set. On top of the latent, it also produces a solid-color placeholder image and can resize an existing image to match, which is why the output list is longer than you'd expect from something that starts as a resolution picker.
How it works
Pick a standard preset, or set custom/random. If you go random, the orientation (all/portrait/landscape/square) and min_res/max_res inputs constrain what it's allowed to pick - genuinely useful if you're batch-generating and want size variety without risking something absurdly tiny or huge sneaking through. The seed makes a random pick reproducible. Separately, if you feed an image into the optional dimensions input, the node can read its size and, with resize enabled, use the same longest_side/divisible_by/scale_factor controls found on the pack's dedicated resize node to produce a resized output - so this one node covers both "give me a blank canvas" and "resize what I already have" depending on which inputs you use.
The inputs and outputs that matter
standard- the preset picker. Start here;customandrandomare the escape hatches for when the presets don't cover what you need.width/height(default 512, step 8) - only relevant whenstandardiscustom.orientation,min_res,max_res- only matter withrandom; they're what stops a random pick from landing somewhere unusable.batch_sizeandlength- batch count and, on the video side of things, frame count for the latent.color(30 choices) - fill color for theempty_imageoutput.divisible_by,scale_factor,longest_side/longest_side_value(optional) - the resize controls, only active when you're feeding an image viadimensionsand haveresizeon.
Eight outputs come back: width, height, batch_size, length, samples (a LATENT ready for your sampler), seed, empty_image (a solid-color placeholder at the chosen size), and resized (only meaningful if you fed it an image to resize).
How to install it
ComfyUI Manager, search GraftingRayman. Manual install:
cd ComfyUI/custom_nodes
git clone https://github.com/GraftingRayman/ComfyUI_GraftingRayman
Restart after. The pack requires OpenAI's CLIP installed separately - without it, nothing in the pack imports. Portable installs: .\python_embeded\python.exe -m pip install git+https://github.com/openai/CLIP.git. System Python: pip install git+https://github.com/openai/CLIP.git.
Common issues & troubleshooting
Pack fails to load. Check your console for the CLIP import error at startup and run the pip command above - this blocks the entire pack, not just the vision nodes.
Sampler errors after using a custom or random size. If divisible_by is left at its default, nothing forces your dimensions to a multiple of 8, which most diffusion models require. Set it explicitly if you're going off-preset.
Random mode keeps giving you sizes you don't want. Tighten min_res/max_res and set orientation - leaving those wide open is what produces surprising picks.
You expected a resized image but got the placeholder color instead. resized only populates if you've wired an image into dimensions and turned resize on; otherwise you're just seeing empty_image, which is solid-colored by design, not a bug in the resize path.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| width | INT | 51216–16000 | — |
| height | INT | 51216–16000 | — |
| standard | COMBO | 58 options: custom, random, 240x240, 320x240, 320x320, 480x480, +52 | |
| orientation | COMBO | 4 options: all, portrait, landscape, square | |
| min_res | COMBO | 57 options: custom, 240x240, 320x240, 320x320, 480x480, 640x480 (VGA), +51 | |
| max_res | COMBO | 57 options: custom, 240x240, 320x240, 320x320, 480x480, 640x480 (VGA), +51 | |
| batch_size | INT | 11–4096 | — |
| length | INT | 1 | — |
| seed | INT | 399807449568993100000000000000–999999999999999 | — |
| color | COMBO | white | 30 options: amethyst, black, blue, cyan, diamond, emerald, +24 |
| resize | BOOLEAN | false | — |
| dimensionsopt | IMAGE | — | |
| longest_sideopt | BOOLEAN | false | — |
| longest_side_valueopt | INT | 256 | — |
| divisible_byopt | INT | 1 | — |
| scale_factoropt | FLOAT | 1.000 | — |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |
| batch_size | INT | — |
| length | INT | — |
| samples | LATENT | — |
| seed | INT | — |
| empty_image | IMAGE | — |
| resized | IMAGE | — |