Nodes/BV Nodes/πŸŒ€ BV Image Size with Math
ComfyUI Node

πŸŒ€ BV Image Size with Math

Grab an image's dimensions and do the math in one step

By BlackVortexAIΒ·Created 2 years agoΒ·Updated 11 months agoΒ· 3
πŸŒ€ BV Image Size with Math
  • image
  • HEIGHT
  • WIDTH
β—„operationmultβ–Ί
β—„math_value1β–Ί

ComfyUI loves multiples of eight. Latents, model-native resolutions, tile sizes - everything wants to divide cleanly, and half your sizing math is "I need this image's dimensions, then divided by something." BV Image Size with Math is the two-for-one: it reads the size of an image and applies one arithmetic operation to it, handing you back the result as two integers.

It's a small node, but it's the difference between hardcoding a resolution that breaks on the next image and computing one that always fits. Wire an arbitrary input image through it, set the operation, and every downstream node gets dimensions that track whatever you feed in.

Inputs

  • image (required) - the image whose size you're reading. Any IMAGE tensor works.
  • operation (default mult) - one of add, sub, mult, div.
  • math_value (default 1) - the operand. So div with 2 halves both dimensions; add with 8 pads both by 8.

Outputs

  • HEIGHT (INT) - the result for the vertical dimension.
  • WIDTH (INT) - the result for the horizontal dimension.

Note the arithmetic applies to both dimensions independently, preserving aspect ratio in the sense that both sides get the same operation - divide by 2 gives you exactly half resolution, add 8 gives you both dims +8. There's no per-axis operand, which is fine for the common cases: half-resolution previews, snapping to multiples, computing a latent size.

Where it slots in

A typical use: grab the image, divide by 8, feed the result into a node that wants a clean latent size or a tile dimension - and since it computes from the actual image every run, changing the input image updates everything downstream automatically. That's the real win versus typing 1024 into five places.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/BlackVortexAI/ComfyUI-BVortexNodes.git

or ComfyUI Manager β†’ "BV Nodes", then restart. No dependencies, no models.

Gotcha

There's no clamping - divide a 5-pixel-tall image by 8 and you get 0, which some downstream nodes will happily accept and then fail on. If you're chaining the output into something strict about dimensions, it's on you to keep the operands sane for the inputs you expect. Also remember both dimensions get the same operation; if you need different scaling per axis, this isn't the node.

CategoryπŸŒ€ BVortex Nodes/Util

Inputs (3)

NameTypeDefaultDescription
imageIMAGEβ€”
operationCOMBOmult4 options: add, sub, mult, div
math_valueoptINT1β€”

Outputs (2)

NameTypeDescription
HEIGHTINTβ€”
WIDTHINTβ€”