Nodes/jlc-comfyui-nodes/ JLC Resize Image
ComfyUI Node

 JLC Resize Image

A Resize Node That Doesn't Break Dynamic Workflows

By Damkohler·Created 6 months ago·Updated 3 days ago· 24
 JLC Resize Image
  • image
  • mask
  • image
  • mask
  • width
  • height
resize_byscale longer dimension
multiplier1.00
longer_size1024
shorter_size1024
width1024
height1024
megapixels1.00
scale_methodarea
divisible_by16

Resize nodes are the plumbing of ComfyUI - nobody gets excited about them, until a workflow won't run because one image is 1024×1024 and another is 1024×968 and something downstream demands matching dimensions. JLC Resize Image is the pack's mid-workflow resize utility: it resizes an incoming IMAGE tensor while preserving aspect ratio, aligns the result to a multiple you choose, and - the part that's actually interesting - it plays nice with dynamic workflows that pass None around on purpose.

There's no file loader and no preview here. This node is for images that already exist in your graph: ControlNet hint prep, normalizing a reference before a preprocessor, squaring up inputs before concatenation. It's the resize half of the pack's Load & Resize node, shipped standalone.

How it works

The core is one shared math function. You pick a resize policy (resize_by), and the node computes target dimensions that preserve the source aspect ratio, then rounds width and height down to divisible_by - 16 by default, which keeps latent and attention-block compatibility. Set divisible_by to 1 to disable the rounding entirely.

The resize_by modes are: scale by multiplier (2.0 doubles both dimensions), scale longer dimension or scale shorter dimension (target the longer/shorter edge, other follows), scale width or scale height (lock one side, the other follows the ratio), and scale total pixels via megapixels. The frontend shows you only the numeric widget for the mode you picked, which keeps the node from looking like a wall of unused fields.

scale_method chooses the interpolation: area is generally the strong default for downscaling, and lanczos is often the better call when you're upscaling.

The None passthrough (why this node exists)

Here's the genuinely useful bit, and it's in the node's own description: if the connected input evaluates to None at runtime, this node deliberately passes None through instead of crashing. That matters in the JLC ecosystem, where dynamic ControlNet and Reference workflows disable slots by having upstream nodes emit None. A naive resize would blow up on a None tensor; this one lets downstream nodes handle the disabled slot gracefully. When that happens, width and height come back as 0 and the mask output is None too.

The mask output deserves a mention: it's resized in lockstep with the image at the same geometry and interpolation. If you feed an aligned mask upstream it comes along for the ride; with none, you get an all-zero mask at the resized dimensions - handy if something downstream expects a mask socket wired.

Inputs and outputs, briefly

The ones you'll actually touch: resize_by (pick your policy), divisible_by, and scale_method. The numeric target (multiplier, longer_size, shorter_size, width, height, megapixels) depends on the mode. Outputs are image, mask, width, height.

Install and gotchas

It's part of jlc-comfyui-nodes, installable through ComfyUI Manager (search "JLC ComfyUI Nodes") or:

cd ComfyUI/custom_nodes
git clone https://github.com/Damkohler/jlc-comfyui-nodes.git

Restart after installing. The pack has no extra Python dependencies and downloads no models.

Two things that will trip you: the output dimensions are rounded down to divisible_by, so don't expect an exact requested size every time - check the width/height outputs if precision matters. And if you pass a mask, its source dimensions must match the image's, or the node raises a clear error about the mismatch. Both behaviors are by design, and both are easy to forget.

Categoryutils/image

Inputs (11)

NameTypeDefaultDescription
imageIMAGEIncoming IMAGE tensor to resize. If the upstream connected node deliberately outputs None at runtime, this node passes None through.
resize_byCOMBOscale longer dimensionAspect-ratio-preserving resize policy.
multiplierFLOAT1.000.01–8Scale factor; 2.0 doubles both dimensions.
longer_sizeINT10241–16384Target size of the source image's longer edge.
shorter_sizeINT10241–16384Target size of the source image's shorter edge.
widthINT10241–16384Target width; height is calculated from aspect ratio.
heightINT10241–16384Target height; width is calculated from aspect ratio.
megapixelsFLOAT1.000.01–64Target total megapixels using 1024×1024 per megapixel.
scale_methodCOMBOareaInterpolation method. Area is generally strong for downscaling; Lanczos is often useful for upscaling.
divisible_byINT161–512After aspect-ratio calculation, round width and height down to this multiple. Use 1 to disable.
maskoptMASKOptional aligned MASK tensor to resize with the IMAGE. When omitted or None, the node returns an all-zero mask at the resized image dimensions.

Outputs (4)

NameTypeDescription
imageIMAGE
maskMASK
widthINT
heightINT