Nodes/was-node-suite-comfyui/Image Size to Number
ComfyUI Node Runs on cloud

Image Size to Number

Read an image's width and height as numbers

By WASasquatch·Created 3 years ago·Updated about a year ago· 1,812
Image Size to Number

      Feed it an image, get its width and height back as numbers you can actually do math on. That's the node. The pack describes it exactly: "get the width and height of an input image to use with Number nodes."

      Trivial-sounding, constantly useful. The moment your workflow needs to react to an image's dimensions instead of assuming them - resize proportionally, build a matching empty latent, center-crop to a ratio, decide whether something's portrait or landscape - you need those dimensions as live values in the graph, not as a number you eyeballed and typed in. This node hands them over.

      Why you'd reach for it

      ComfyUI graphs are happier when they're driven by data than by hardcoded constants. Say you load images of unknown size and want everything downstream to adapt: pull width and height off the loaded image, and now your resize target, your latent size, and your upscale math all follow the source automatically. Change the input image and the whole pipeline reflows without you touching a single number field.

      It's the bridge between the image world (pixels in a tensor) and the number world (WAS's Number nodes, which do arithmetic, comparisons, and conditionals). Once dimensions are numbers, you can multiply width by 1.5 for an upscale target, compare height against a threshold, or feed both into an Empty Latent sized to match.

      How it works

      The node inspects the image tensor's shape and reports its pixel width and height. No processing of the pixels themselves - it's reading metadata off the tensor, so it's instant and free.

      The inputs and outputs that matter

      • image - the picture you want measured. One input, that's it.

      The outputs are the width and height as numbers, ready to plug into WAS's Number Operation, Number Input Condition, an Empty Latent's dimension inputs, or a resize node. In keeping with the pack's number system you can route these into integer or float conversions depending on what the downstream node expects.

      Installing it

      Comes with WAS Node Suite. ComfyUI Manager: search WAS Node Suite, install, restart. Manually:

      cd ComfyUI/custom_nodes
      git clone https://github.com/WASasquatch/was-node-suite-comfyui
      

      install requirements.txt against your ComfyUI Python, restart.

      Common issues

      Downstream node rejects the value (wants int, got float, or vice versa). WAS numbers flow through a couple of types. If a latent or resize input complains, run the width/height through the matching WAS conversion node (Number to Int / Number to Float) before connecting. This is the single most common friction point with the pack's number nodes.

      I fed a batch and got one size. All images in a ComfyUI batch share the same dimensions, so one width/height describes the whole batch. If your "batch" has mixed sizes, something upstream already resized them to match - that's normal.

      Node's gone after an update. That's the pack, not the node. WAS Node Suite is retired and unmaintained since late 2023; its dependency pins clash with ComfyUI updates and produce an "Import Failed" that removes every WAS node until you reinstall the pack's requirements.txt against the correct ComfyUI environment.

      Small node, big convenience. If you only ever generate at one fixed resolution you'll never need it. If you process images of varying sizes, it's the first node in the chain that makes the rest adapt on its own. The pack also has Latent Size to Number if you need the same thing off a latent rather than a decoded image.

      Categoryx

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs