Nodes/ComfyUI-PainterNodes/Painter Resize Images
ComfyUI Node

Painter Resize Images

Fit your frames to a long edge, keep the ratio

By princepainter·Created 7 months ago·Updated 5 days ago· 194
Painter Resize Images
  • images
  • image
  • width
  • height
long_edge1024

Every video model wants its own resolution, and every reference image you feed it is the wrong size. PainterResizeImages is the utility that fixes that in the least surprising way possible: give it an images tensor and a long_edge, and it scales everything so the longest side of each image equals that value, aspect ratio preserved. In, out, three ports, no surprises. It's the "make my references legal" node you didn't know you were looking for until the third time a conditioning node choked on a 4K source.

What it is

A Painter/Utils node with a single job: resize image batches to a target long edge. Inputs are images and long_edge (default 1024, 1–8192); outputs are the resized image, plus width and height ints for the result.

How it works

The math is the boring kind you can trust. It looks at each frame, finds whether height or width is the longer side, and scales so that side lands exactly on long_edge - the other side follows proportionally. Portrait stays portrait, landscape stays landscape; nothing gets squashed into a box, nothing gets padded with bars. The width and height outputs let downstream nodes read what actually happened instead of assuming.

It handles the degenerate case gracefully too: an empty input returns a harmless 64×64 placeholder rather than crashing, which is more than a lot of utilities bother with.

Where you'd use it

The standard pattern is in front of any conditioning or reference node that cares about size: resize your reference images to the model's comfortable input range (1024-ish) before they hit a ref-to-video or image-edit node, and you avoid both VRAM bloat from giant sources and the weird artifacts models produce when fed extreme resolutions. In this pack it pairs naturally with the MiniMax ref nodes and Bernini's reference inputs, where the node handles its own downscaling anyway - but for everything else, this is the general-purpose gatekeeper. If you're chaining multiple images, it normalizes them all to one long edge, which is exactly what a concat or batch operation wants.

Install

Part of the PainterNodes pack. ComfyUI Manager → search "PainterNodes" → install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/princepainter/ComfyUI-PainterNodes
cd ComfyUI-PainterNodes
pip install -r requirements.txt

Common issues

  • "Wrong" resolution - it's a long-edge target, not a width-and-height target. 1024 on a portrait image gives you 1024-tall, not 1024-wide. If you need exact dimensions, this isn't the node - use a resize with explicit width/height instead.
  • Upscaling surprise - if your source is smaller than long_edge, it upscales to hit the target. Feeding a 512px image a 4096 long edge is upscaling, not just normalizing; keep the target near the model's native range.
  • No interpolation choice - it resizes internally and you don't get to pick the method. Fine for conditioning prep; don't use it as your final upscaler.

It's a 64-line utility in a pack full of 400-line video monsters, and that's the appeal: when you need a batch of images at a sane size, this does it in one node and hands you the numbers to prove it.

CategoryPainter/Utils

Inputs (2)

NameTypeDefaultDescription
imagesIMAGE
long_edgeINT10241–8192

Outputs (3)

NameTypeDescription
imageIMAGE
widthINT
heightINT