ComfyUI Node

HT Downsample

Shrink to a size, not a guess

By ArtHommage·Created 2 years ago·Updated about a year ago· 4
HT Downsample
  • image
  • downsampled_image
target_long_edge1024
interpolationbicubic
devicecpu

You have a 4096px render and you need a 1024px version for previews, training prep, or a model that only eats small inputs. HT Downsample, from HommageTools, is a resize node that targets the long edge - so it keeps the aspect ratio and just caps the largest dimension at whatever you ask for. No cropping, no stretching, no surprise letterboxing.

The inputs that matter

  • image - the source.
  • target_long_edge (default 1024) - the size the longest side should become. A portrait and a landscape fed the same value both come out with their long edge at exactly that number, with the short edge scaled proportionally.
  • interpolation - nearest, bilinear, bicubic (default), area, lanczos. For downsampling, area is the technically correct choice (it averages pixels, which is what "shrink" should mean), and lanczos keeps more perceived sharpness at a slight cost in ringing. Bicubic is the safe middle.
  • device - cuda or cpu, default cpu. Worth a glance: the default keeps it off the GPU, which is usually fine for downsampling since it's cheap, but if you're piping a big batch through, switching to cuda can shave real time.

The single output, downsampled_image, is a plain IMAGE you can feed anywhere an image socket expects one.

How it behaves

The source is obsessive about tensor formats - it validates BHWC/HWC, checks for NaN and infinity, and recovers from odd shapes - which is the pack's signature concern and genuinely matters when you're shrinking images that came out of a VAE decode with a wonky channel count. The upshot for you: it's unusually tolerant of weird inputs and it logs clearly when something's off, instead of silently corrupting the output.

It also enforces a sensible minimum size (8px) so a bad target_long_edge can't collapse the image to nothing.

Where it fits

This is the front half of a lot of pipelines: prep an input for a network with size constraints, build multi-resolution preview sets, or normalize a folder of wildly different images before a batch process. It pairs naturally with HT Dimension Analyzer when you want the actual numbers to drive downstream decisions.

It's a downsample-only node - if you need to upscale, look elsewhere (the modidex upscaling notes are the right rabbit hole; tiled diffusion and ControlNet Tile are where that story goes). This one is firmly in "make it smaller, correctly" territory, and it does that well.

Installing it

Part of HommageTools. ComfyUI Manager → search HommageTools, or:

cd ComfyUI/custom_nodes
git clone https://github.com/ArtHommage/HommageTools.git
cd HommageTools && pip install -r requirements.txt

Restart ComfyUI; find it under HommageTools/Image.

The one trap

The device defaulting to cpu catches people: on a big batch, "why is this slower than my sampler?" - because you told the shrinker to run on the CPU. Flip it to cuda for batch work and move on. Otherwise, set your long edge, pick area or lanczos, and it just works.

CategoryHommageTools/Image

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
target_long_edgeINT102464–8192
interpolationCOMBObicubic5 options: nearest, bilinear, bicubic, area, lanczos
deviceCOMBOcpu2 options: cuda, cpu

Outputs (1)

NameTypeDescription
downsampled_imageIMAGE