Nodes/ComfyUI-LexTools/ImageScaleToMin
ComfyUI Node

ImageScaleToMin

A scale factor that keeps every image at a sane size

By SOELexicon·Created 3 years ago·Updated about a year ago· 33
ImageScaleToMin
  • image
  • FLOAT
MinScalePix512

Half of image processing is getting everything to a comparable size before you feed it into a model. ImageScaleToMin doesn't resize anything itself - it computes the scale factor that would make the image's smallest dimension equal to a target (512 by default), and hands you that number. You take the number, feed it into your upscale node, and now every image in a batch ends up with the same minimum dimension no matter how varied the batch is.

That's a boring-sounding superpower, and it's the reason to keep the node around. Models like CLIP encoders, aesthetic scorers, and most analysis models behave differently depending on input resolution - feed them a 300px thumbnail and a 1600px render and you're not comparing like with like. Scale everything so its short side is 512 first, and your scores, captions, and classifications are actually comparable. The README frames it as "scaling images down to 512 or up to 512 for faster processing", and that's the honest use: downscale before heavy analysis, upscale before generation.

How it works

Trivial math, which is why the node is small. It looks at the image's width and height, finds the smaller of the two, and computes scale = MinScalePix / min_dimension. If the short side is already 512, you get 1.0 back. The output is a plain FLOAT - no image leaves this node, just the number.

Inputs:

  • image - the IMAGE whose dimensions you want normalized around.
  • MinScalePix - the target for the smallest dimension. Default 512, adjustable up to 2056. Most analysis models are happiest at 512; push it higher if your analysis model is resolution-sensitive and you have the VRAM.

Output: a single FLOAT scale value. Wire it into the scale_by or upscale input of your resize node, or into a Multiply if you're feeding it into something that expects a factor.

Where it slots in

Realistic chain: LoadImage → ImageScaleToMin → scale → ImageQualityScoreNode (or a classifier) → sort. You normalize every input to the same short side, score them, and the scores actually mean something. It's also useful right before an upscale workflow where you want "biggest side N" behavior but your model thinks in minimums. Slightly quirky tool, but once you've set up one scored batch you'll miss it when it's gone.

Install and notes

Install is the pack install, one time: ComfyUI Manager → search "ComfyUI-LexTools", or git clone https://github.com/SOELexicon/ComfyUI-LexTools into custom_nodes and restart. No model downloads, no heavy deps - this is the cheap utility in the pack.

The one thing that trips people: it returns a factor, not a target resolution. If your resize node takes "width and height" rather than a multiplier, you'll need to multiply the original dimensions by this float yourself (a couple of math nodes), or use a resize node that accepts scale_by. Also note it's "at least one dimension becomes 512" - a very wide panorama will end up short-side 512 and long-side huge, which may not be what you wanted for a square-bound model. There are core ComfyUI resize nodes for that case.

CategoryLexTools/ImageProcessing/upscaling

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
MinScalePixoptFLOAT5120–2056

Outputs (1)

NameTypeDescription
FLOATFLOAT