Nodes/GraftingRayman/GR Image Size
ComfyUI Node

GR Image Size

An EmptyLatentImage with 58 resolution presets and a random-size mode

By GraftingRayman·Created 2 years ago·Updated about a month ago· 76
GR Image Size
  • dimensions
  • width
  • height
  • batch_size
  • length
  • samples
  • seed
  • empty_image
  • resized
width512
height512
standard
orientation
min_res
max_res
batch_size1
length1
seed399807449568993
colorwhite
resizefalse
longest_sidefalse
longest_side_value256
divisible_by1
scale_factor1.000

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; custom and random are the escape hatches for when the presets don't cover what you need.
  • width / height (default 512, step 8) - only relevant when standard is custom.
  • orientation, min_res, max_res - only matter with random; they're what stops a random pick from landing somewhere unusable.
  • batch_size and length - batch count and, on the video side of things, frame count for the latent.
  • color (30 choices) - fill color for the empty_image output.
  • divisible_by, scale_factor, longest_side/longest_side_value (optional) - the resize controls, only active when you're feeding an image via dimensions and have resize on.

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.

CategoryGraftingRayman/Images

Inputs (16)

NameTypeDefaultDescription
widthINT51216–16000
heightINT51216–16000
standardCOMBO58 options: custom, random, 240x240, 320x240, 320x320, 480x480, +52
orientationCOMBO4 options: all, portrait, landscape, square
min_resCOMBO57 options: custom, 240x240, 320x240, 320x320, 480x480, 640x480 (VGA), +51
max_resCOMBO57 options: custom, 240x240, 320x240, 320x320, 480x480, 640x480 (VGA), +51
batch_sizeINT11–4096
lengthINT1
seedINT399807449568993100000000000000–999999999999999
colorCOMBOwhite30 options: amethyst, black, blue, cyan, diamond, emerald, +24
resizeBOOLEANfalse
dimensionsoptIMAGE
longest_sideoptBOOLEANfalse
longest_side_valueoptINT256
divisible_byoptINT1
scale_factoroptFLOAT1.000

Outputs (8)

NameTypeDescription
widthINT
heightINT
batch_sizeINT
lengthINT
samplesLATENT
seedINT
empty_imageIMAGE
resizedIMAGE