Image_Resize_sum
Resize, pad or crop an image — and keep the receipt to undo it
- image
- mask
- get_image_size
- mask_stack
- IMAGE
- mask
- stitch
- scale_factor
This is the workhorse resize node in the pack, and the "sum" in the name is a hint: it bundles every common resize strategy - fit-inside, stretch, pad, edge-pad, crop-to-fit - into one node, and crucially it also hands you back a small data packet (stitch) that remembers exactly what it did. Wire that packet into Image_Resize_sum_restore later and you can undo the resize precisely, which is the whole point if you're shrinking an image down for a sampler pass and need to paste the result back onto the original canvas afterward.
The pattern this follows
If you've done inpainting work, you've probably run into the crop-then-stitch pattern popularized by nodes like Inpaint Crop and Stitch: shrink to a working size, process, then restore the original resolution without ever touching the pixels outside your working region. Image_Resize_sum is this pack's own version of that same idea, generalized to plain resizing rather than just inpainting. It's a genuinely useful pattern - it's much cheaper to run a sampler at 1024px than at your source's native 4000px, and stitching back means you're not stuck living with the downscaled result.
One real caveat: the stitch output here is a custom type (STITCH3) specific to this pack. It will not plug into another pack's crop-and-stitch nodes, and this pack's other crop family (Image_solo_crop/Image_solo_crop2) outputs a different bundle type (STITCH2) that won't plug into this node's restore node either. Match the family: Resize_sum → Resize_sum_data/Resize_sum_restore, solo_crop/solo_crop2 → Solo_data/solo_stitch.
The inputs and outputs that matter
width/height(INT, default 512 each) - your target dimensions.keep_proportion- the mode:resize(scale to fit inside the bounds, no crop or fill - may leave the image smaller than your target on one axis),stretch(force the exact dimensions, distorting aspect ratio),pad(scale to fit, then letterbox the rest with a solid color),pad_edge(same idea, but fills with the image's own edge color instead of a flat color - usually less jarring), orcrop(crop to the target aspect ratio first, then scale).pad_color- the fill color forpadmode (black, white, red, green, blue, gray).crop_position- anchor forcropmode (center, top, bottom, left, right).divisible_by(INT, default 2) - rounds the final size to a multiple of this. Bump it to 8 or 64 if you're feeding a sampler that wants a clean VAE-aligned size.pad_mask_remove(BOOLEAN, default true) - strips the mask over the padded area so downstream nodes don't treat the letterbox bars as part of your subject.- Optional
maskandmask_stack(this pack's ownMASK_STACK2bundle) if you need the resize to carry a mask along with it.
Four outputs: the resized IMAGE, the carried-through mask, the stitch bundle (STITCH3 - feed to Image_Resize_sum_data or Image_Resize_sum_restore), and scale_factor (FLOAT) - the actual scale applied, useful if you want to reason about the resize without decoding the stitch bundle.
How to install it
ComfyUI Manager: search ComfyUI-Apt_Preset, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset
pip install -r requirements.txt
install.bat is Windows-only; on Linux (comfy.icu included) run pip install -r requirements.txt directly. No model downloads for this node - it's pure image math.
Common issues
The most common trip-up is mode confusion: stretch and crop both hit your exact target dimensions but get there differently - stretch distorts the content, crop discards content. If your subject looks squished, you picked stretch when you wanted crop, or vice versa. Second, remember the stitch output is type-locked to this node's own restore/data nodes - if a wire won't connect where you expect, you're probably crossing it with the solo_crop family's STITCH2. And as with every node in this pack, a fresh install pulls in a large, mostly-unrelated requirements.txt (onnxruntime, gguf, transparent-background, and more for the pack's other 100+ nodes) - if the pack fails to import at all, check the ComfyUI console for the real missing-package error rather than assuming this specific node is broken.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| width | INT | 5120–9999 | — |
| height | INT | 5120–9999 | — |
| upscale_method | COMBO | bilinear | 5 options: nearest-exact, bilinear, area, bicubic, lanczos |
| keep_proportion | COMBO | 5 options: resize, stretch, pad, pad_edge, crop | |
| pad_color | COMBO | black | 6 options: black, white, red, green, blue, gray |
| crop_position | COMBO | center | 5 options: center, top, bottom, left, right |
| divisible_by | INT | 20–512 | — |
| pad_mask_remove | BOOLEAN | true | — |
| maskopt | MASK | — | |
| get_image_sizeopt | IMAGE | — | |
| mask_stackopt | MASK_STACK2 | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| mask | MASK | — |
| stitch | STITCH3 | — |
| scale_factor | FLOAT | — |