Image_pad_keep
Rotate, scale, and place one image onto another
- image
- canvas_image
- image
- pad_mask
Not a "pad to fit a model" node like its pad_adjust siblings - this one is a manual transform-and-place tool. Give it an image, dial in position, zoom, rotation, and shear, and it drops the transformed result onto a canvas, optionally an existing image you supply rather than a flat backdrop.
How it works
x/y set position offset, zoom (default 1) scales, angle (−360 to 360) rotates, and shear skews. border_handling (edge/constant/reflect/symmetric) decides what fills in at the transformed image's own edges once it's rotated or sheared off its original rectangle - standard affine-transform boundary handling. scale_mode (nearest-exact/bilinear/area/bicubic/lanczos) picks the interpolation used for the resize. constant_color supplies the fill when border_handling is "constant". canvas_image (optional) lets you place the transformed result onto an existing image instead of a blank one.
The inputs and outputs that matter
x/y- position offset of the transformed image, not the destination canvas.zoom(default 1),angle(default 0),shear(default 0) - the actual transform.scale_mode(default"bilinear") - interpolation quality; matters most on rotation and scale.canvas_image(optional) - place onto this instead of a flat background.- Output:
image,pad_mask.
How to install it
Via ComfyUI Manager: search ComfyUI-Apt_Preset, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git
Windows: install.bat. Linux/Mac: pip install -r ComfyUI-Apt_Preset/requirements.txt in your venv. Restart. Nothing to download for this node - the pack's heavier dependencies belong to other parts of this ~300-star, actively maintained pack.
Common issues & troubleshooting
Rotated or sheared edges look jagged. Try a smoother scale_mode - bicubic or lanczos over nearest-exact, which is fast but visibly blocky on anything but plain axis-aligned scaling.
Placement onto canvas_image looks offset from what you expected. x/y position the transformed image, not the destination canvas as a whole. Get zoom and angle right first, then nudge x/y - trying to solve all four at once tends to produce confusing results.
Border artifacts after a big rotation or shear. border_handling decides what fills the gaps a rotated rectangle leaves behind - "edge" (the default) repeats the nearest pixel, "reflect"/"symmetric" mirror the image back on itself, and "constant" uses a flat constant_color fill. If you're seeing streaky repeated pixels at a corner, that's "edge" doing exactly what it's supposed to on a shape that no longer fits its own rectangle - switch to "constant" with a color that matches your scene if a hard edge looks better than a stretched one.
Use case worth knowing about. This is the node for manually placing a generated element into a scene at an angle - a prop, a sticker, a second subject - rather than relying on a model to compose it correctly, or for building a collage where pieces need independent rotation and scale instead of a straight side-by-side layout. Because it also outputs pad_mask, you can feed the result straight into an inpaint pass to blend the placed element into its new background rather than leaving it as an obvious paste.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| x | FLOAT | 0-4096–4096 | — |
| y | FLOAT | 0-4096–4096 | — |
| zoom | FLOAT | 1.00 | — |
| angle | FLOAT | 0-360–360 | — |
| shear | FLOAT | 0-4096–4096 | — |
| border_handling | COMBO | edge | 4 options: edge, constant, reflect, symmetric |
| scale_modeopt | COMBO | bilinear | 5 options: nearest-exact, bilinear, area, bicubic, lanczos |
| constant_coloropt | COMBO | black | 6 options: white, black, red, green, blue, gray |
| canvas_imageopt | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| pad_mask | MASK | — |