Get Image Size

The Get Image Size node reads an input image and outputs its width and height in pixels, enabling dimension‑aware workflows in ComfyUI such as dynamic resizing, cropping, layout, or validation before generation. It is a simple but essential utility node for building robust, resolution‑sensitive pipelines.

Overview

Get Image Size takes an image tensor and extracts its spatial dimensions, usually as integer values representing width and height. These values can be wired into nodes that require explicit sizes (for example, resize, upscale, tiling, or model‑specific resolution helpers), or used in logic/control nodes to branch or adapt behavior based on incoming image size. It is typically placed directly after a Load Image, Decode, or any node producing an IMAGE.

Visual Example

Get Image Size ComfyUI node
Figure 1 - Get Image Size ComfyUI node

Official Documentation Link

https://comfyai.run/documentation/GetImageSize

Inputs

Parameter Data Type Input Method
image IMAGE Node connection from any image‑producing node

Outputs

Output Name Data Type Description
width INT Width of the input image in pixels
height INT Height of the input image in pixels

Usage Instructions

Connect the image input to any node that outputs an IMAGE, such as Load Image, ImageScale, or a decoder node. Once wired, the Get Image Size node will compute and expose the image’s width and height as integer outputs. These can then be plugged directly into nodes like Image Resize, Upscale Image, or custom math/logic nodes to dynamically adjust operations based on the actual image dimensions without manually checking properties in an external viewer.

Advanced Usage

In more advanced graphs, Get Image Size can serve as part of an automated layout or resolution‑management system: for example, you can feed width/height into arithmetic nodes to compute aspect ratios, half or double resolutions, or model‑specific safe sizes, then forward those computed values into resize or tiling nodes. When working with batched images or variable‑sized inputs, this node enables dynamic adaptation—such as only upscaling images smaller than a target resolution, or routing images to different branches depending on orientation (portrait versus landscape). Combined with conditionals or switch‑style nodes, you can build robust, size‑aware template workflows.

Example JSON for API or Workflow Export

{
  "id": "get_image_size_1",
  "type": "GetImageSize",
  "inputs": {
    "image": "@load_image_1"
  }
}

Tips

  • Use width and height outputs directly as parameters for resize or upscale nodes to avoid typos and mismatches.
  • Compute derived dimensions (for example, width ÷ 2) using math nodes before passing them to image‑processing nodes.
  • For workflows that must obey model‑specific resolution constraints, pair this node with resolution‑helper/custom sizing nodes that snap values to valid multiples.
  • If you just want to inspect image size interactively, temporarily connect the outputs to a UI or debug node that displays integers in the graph.
  • When dealing with images of varying sizes (user uploads, datasets), always cache and reuse the reported dimensions rather than hardcoding constants.

How It Works (Technical)

The node inspects the shape of the incoming image tensor—typically in the form [batch, channels, height, width]—and extracts the spatial dimensions (height and width) of the first image or of the batch as a whole. It then returns these dimensions as integer outputs without altering the underlying image data. Because the operation is purely analytical and does not modify pixels, it is lightweight and safe to use anywhere in a workflow to query image size on demand.

Github alternatives

  • GetImageSize+ – an enhanced variant that can also report batch count or channel information, useful for more complex pipelines.
  • ComfyUI-Image-Size-Tools – a node pack that computes model‑specific, constraint‑aware resolutions and recommended sizes built on top of basic image dimension queries.
  • Get Image Size (JPS) – a utility variant that similarly outputs width and height, tailored for use alongside other JPS tooling nodes.

Videcool workflows

The Get Image Size node is used in the following Videcool workflows:

FAQ

1. Does Get Image Size change the image in any way?
No. It only reads the tensor’s dimensions and outputs width and height; the input image is passed through unchanged if also exposed, or left untouched.

2. Can this node handle batched images?
Yes. It reads dimensions from the image tensor; depending on implementation it typically reports the size of each frame if they are identical, or of the first image in the batch.

3. What kinds of images can I connect to it?
Any valid IMAGE tensor produced by ComfyUI—loaded images, decoded latents converted to images, or intermediate processed images.

Common Mistakes and Troubleshooting

Most issues arise from connecting a non‑image type (such as a latent tensor) to the node, which expects an IMAGE and may fail or return unexpected dimensions. Ensure you convert latents to images (for example, via VAE Decode) before querying size. Another frequent pitfall is assuming that width and height are interchangeable; always wire them to the correct inputs on downstream nodes. When working with images that change shape later in the graph (after cropping or resizing), remember to recompute size using a new Get Image Size node if you rely on up‑to‑date dimensions.

Conclusion

Get Image Size is a lightweight yet foundational utility node that exposes image dimensions to the rest of your ComfyUI graph, enabling dynamic, resolution‑aware workflows that adapt to any input without manual inspection or hard‑coded sizes.

More information