Nodes/ComfyUI_UnfakePy_Warpper/Image Downscale By Factor
ComfyUI Node

Image Downscale By Factor

Shrink your render down to sprite scale without interpolation mush

By AhBumm·Created 11 months ago·Updated 9 months ago· 2
Image Downscale By Factor
  • image
  • out_img
  • width
  • height
scale_factor1.0

Say your pixel-art LoRA renders at 512x512 but the sprite is really supposed to be 128x128. You need the image half the size, or a quarter, with the pixels staying crisp. That's this node's whole job: downscale by a factor - 2, 3.5, whatever - using nearest-neighbor resampling, so no interpolation smears the edges. In the upscaling world this is the "more pixels, nothing added" category, except going down: deterministic, instant, CPU-only, and it will not invent or blur a single pixel.

How it works

Nothing clever, which is the point. Each frame in the batch gets resized with Pillow's Image.Resampling.NEAREST, with the new dimensions computed as int(original // scale_factor). The batch is preserved - frames loop through, get resized, and come back as one tensor. Two guards are worth knowing: a scale_factor of exactly 0 returns the image unchanged, and if the math would produce a dimension smaller than 1 pixel it clamps back to the original size instead of crashing. Outputs are out_img plus width and height (the actual dimensions, handy for wiring into latent or canvas nodes).

The inputs

Just two:

  • image - the render to shrink.
  • scale_factor (FLOAT, default 1.0, range 0–100, step 0.1) - divide the dimensions by this. 2 = half size, 4 = quarter, 0.5 would upscale (though the sibling Image Upscale By Integer is the saner tool for that).

That's it. The main knob to keep in your head: the division truncates. A 512px image at factor 1.5 gives 341px, not 341.33. For pixel art, pick factors that divide cleanly - 2, 4, 8 - or use the exact W&H node (Image Downscale By W&H in this pack) when you need a specific size and can supply both dimensions.

Installing it

Same pack, same path as the others:

cd ComfyUI/custom_nodes
git clone https://github.com/AhBumm/ComfyUI_UnfakePy_Warpper

Or via ComfyUI Manager → Install Custom Nodes → search ComfyUI_UnfakePy_Warpper, then restart. Dependencies are unfake==1.0.7 and nest_asyncio (unfake pulls in opencv, Pillow, NumPy; Python 3.10+). No models, no GPU.

When you'd reach for it

The natural spot is a pre-cleanup step: render big, downscale by an integer factor to sprite scale, then run Unfake Pixelate Tools or Force Detect Pixelate Scale to nail the grid. Nearest-neighbor downscaling is also the correct way to make a fake-pixel image more convincingly pixelated before any palette work - every block becomes flat and hard-edged, which is exactly what a pixel artist's eye is looking for. If the result has blocky color noise, that's the source image's problem; factor scaling can't fix color mixing, only make it visible.

CategoryBillBum/PixelTools

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
scale_factorFLOAT1.00–100

Outputs (3)

NameTypeDescription
out_imgIMAGE
widthINT
heightINT