图像分区 · 16 对齐整数倍缩小
The 16-aligned integer downscale that doesn't smear your edit budget
- image
- model_image
One node. One input. One output. RegionEditExactIntegerDownscale is the simplest thing in the whole Region Edit Toolkit, and it exists because "shrink this image so a 1024-class model can eat it" turns out to be surprisingly easy to botch. If you just resize to fit, you get fractional scaling factors that scramble fine detail and land on non-16 multiples that your VAE and any strict composite will resent. This node insists on an exact integer divisor - a 2x, 3x, 4x downscale, never 2.3x - while keeping 16-pixel alignment.
The ComfyUI-Smart-Removal pack is built around strict coordinate compositing, and every strict composite cares that the image you edit and the image you paste back share the same geometry story. An integer-factor downscale makes that story trivially true: the original is exactly N times the downscaled image, so mapping coordinates back is exact arithmetic instead of float roulette. In the face workflows, this is the gate that takes a big head crop down to model size for the generation pass.
How it works
Given maximum_short_edge (default 1024), it plans a scale factor that keeps the image's short edge at or under that limit, then forces the factor to be an exact integer divisor of both dimensions. On top of that, the result is 16-aligned - the plan helper (_plan_exact_integer_downscale) snaps the output dimensions so they're clean multiples of 16. Resampling is done with Lanczos (_resize_lanczos_exact), which is the right choice for a downscale you're going to edit and enlarge again: it keeps edges crisp instead of mushy.
It's a planning-plus-execution node, so unlike RegionEditBoundedImageSizePlan (which only computes numbers), this one actually returns the resized image. The one output, model_image, is what you feed the sampler. If your image is already small enough, it comes back effectively untouched - no unnecessary re-sampling, no invented interpolation artifacts.
The one input
maximum_short_edge: the ceiling for the image's shorter side. 1024 is right for most 1024-native models; drop to 768 if your card is small or the model is an SD1.5-class thing. Step is 16, and the input range is 256–4096.
Install
The whole pack shares one install: ComfyUI Manager → search "Region Edit Toolkit" (package ID native-region-tile-planner-merge) → install → restart. Or git clone https://github.com/Liu-Bot24/ComfyUI-Region-Edit-Toolkit.git into ComfyUI/custom_nodes, then pip install -r requirements.txt into ComfyUI's actual Python environment (portable: ComfyUI_windows_portable\python_embeded\python.exe; venv: venv\Scripts\python.exe), restart. Python 3.10+; the deps are numpy, Pillow, scipy, argostranslate. No model downloads - this is pure tensor math.
Gotchas
There aren't many ways to trip this up, which is the point. The main thing to know: it's a lossy resize and it's meant to be. When you run your edit and composite back, the pack expects you to upscale the result to the original crop size (or better, have the strict composite handle the geometry). Don't feed the downscaled image back into the full-frame pipeline and expect pixel-perfect placement - that's what the coordinate-tracking nodes are for. And if you were reaching for this to upscale a tiny image, wrong node - this only ever shrinks.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| maximum_short_edge | INT | 1024256–4096 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| model_image | IMAGE | — |