Nodes/comfyui-missed-tool/Scale Image to Multilple Pixels
ComfyUI Node

Scale Image to Multilple Pixels

Scale Image to Multilple Pixels doesn't scale anything — it crops, and that's the point

By ifmylove2011·Created about a year ago·Updated 6 days ago· 3
Scale Image to Multilple Pixels
  • image
  • IMAGE
positioncenter
base_pixels8

The display name says "Scale Image to Multilple Pixels" (yes, with the typo - that's the author's, not mine). But this node doesn't scale, stretch, or resize a thing. What it does is crop your image so both dimensions land on exact multiples of a base number. If that sounds disappointingly small, read the README example and it clicks: a 533×433 image with base_pixels set to 100 comes out 500×400. You lose the odd 33 and 33 pixels and get a cleanly aligned canvas.

Why you'd bother

Because image models are picky about dimensions. SD-family autoencoders want latent sizes that divide by 8, tiling pipelines want tiles that land on a grid, and upscale workflows (the tiled-diffusion kind) run much happier when input dimensions are clean multiples. A 1021×1021 image is a classic troublemaker; knocking it to 1016×1016 (multiple of 8) avoids the size-mismatch errors that haunt tiled upscaling and ControlNet tile pipelines. This node is the cheap pre-flight check: snap your canvas to the grid before it hits something that cares.

The inputs that matter

  • image - what you're fixing.
  • base_pixels - the multiple to snap to. Default 8, which is exactly the latent alignment ComfyUI wants. The README's example uses 100, but for most pipelines 8 is the number you'll leave alone.
  • position - where the crop is anchored, from nine options (top-left, top-center, top-right, right-center, bottom-right, bottom-center, bottom-left, left-center, center). Default center.

That last one is the whole decision: since you're losing pixels from the edges, position decides which edge you're willing to lose. A face off-center in the frame? Anchor the crop so the face's side survives.

How it actually works

It floor-divides the width and height by base_pixels, then slices the image to that rectangle at the chosen anchor. No interpolation, no resampling, no upscaling - pure crop. That's also the "gotcha" spelled out: if you wanted to make a 533px image bigger to hit a multiple, this isn't your node. It only ever shrinks (by up to base_pixels−1 on each axis) and it trims the edges rather than squeezing the content. If you actually want to resize, the core Upscale Image node is the tool; this one is strictly about alignment.

Install

Same as every node in this pack - ComfyUI Manager, search comfyui-missed-tool, or:

cd ComfyUI/custom_nodes
git clone https://github.com/ifmylove2011/comfyui-missed-tool.git

Restart, and it's under missed-tool as "Scale Image to Multilple Pixels". No dependencies, no model files - it's a few lines of torch slicing, which is exactly why it's worth having around.

Categorymissed-tool

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
positionCOMBOcenter9 options: top-left, top-center, top-right, right-center, bottom-right, bottom-center, +3
base_pixelsINT8

Outputs (1)

NameTypeDescription
IMAGEIMAGE