Nodes/MTB Nodes/Transform Image (mtb)
ComfyUI Node Runs on cloud

Transform Image (mtb)

Pan, zoom, rotate and shear in the graph

By melMass·Created 3 years ago·Updated about a month ago· 721
Transform Image (mtb)
  • image
  • constant_color
  • IMAGE
x0
y0
zoom1.00
angle0
shear0
border_handlingedge
filter_typebilinear
stretch_x1.00
stretch_y1.00
use_normalizedfalse

A proper 2D transform node: translate, zoom, rotate, shear, and stretch an image, all in one place, while keeping the output the same tensor shape as the input. If you've ever wanted to nudge a composite over a few pixels, spin an element, or Ken-Burns a still into a slow push-in across a batch of frames, this is the node.

The "keeps the tensor shape" part is the practical bit. Because it hands back an image the same size as it took in, you can drop it mid-graph without breaking everything downstream that expects a fixed resolution - and it's why this shows up so often in animation setups, where you want to animate a transform over a batch without the canvas dimensions drifting.

How it works

It builds a 2D affine transform from your parameters and resamples the image through it. The interesting choices are what happens at the edges (the area exposed when you move or rotate) and which resampling filter it uses.

The inputs that matter

  • x / y - translation. By default these are in pixels (range ±4096). Positive/negative pushes the image around the frame.
  • zoom - scale factor (1 = no change). Above 1 pushes in, below 1 pulls out.
  • angle - rotation in degrees (±360).
  • shear - slants the image, the skew you'd use for a fake-perspective or italic effect.
  • border_handling - what fills the newly-exposed area: edge smears the edge pixels outward (default), constant fills with constant_color, and reflect/symmetric mirror the image back on itself. This is the setting that decides whether a rotated image gets an ugly black corner or a clean fill.
  • filter_type (optional) - resampling quality: nearest (fastest, blocky) up to bicubic and lanczos (best, slowest). bilinear is the balanced default. One catch straight from the node's docs: lanczos and hamming don't support rotation - if you're rotating, stick to bilinear or bicubic.
  • stretch_x / stretch_y and use_normalized (optional) - non-uniform scaling, and a toggle to interpret x/y as normalized 0–1 coordinates instead of pixels, handy when you want the same move to scale across different resolutions.

Single IMAGE output.

How to install it

ComfyUI Manager: search MTB Nodes (comfy_mtb), install, restart. Or manually: cd ComfyUI/custom_nodes && git clone https://github.com/melMass/comfy_mtb and restart. Pure Python - nothing to download.

Common issues

The rotation-plus-filter gotcha is the one that surprises people: pick lanczos for quality, add an angle, and it won't rotate as expected. Use bicubic when you need both quality and rotation.

The other is edge fill. Rotate or move an image and something has to fill the gap. Left on edge, you get streaky smears; that's often fine for a subtle push-in and terrible for a big rotation. Switch to constant (with a constant_color that matches your scene) or reflect for a cleaner result. And if you're animating this across a batch, small per-frame changes look smooth while big jumps stutter - key your values gently and let the motion accumulate over frames.

Categorymtb/transform

Inputs (12)

NameTypeDefaultDescription
imageIMAGE
xFLOAT0-4096–4096
yFLOAT0-4096–4096
zoomFLOAT1.00
angleFLOAT0-360–360
shearFLOAT0-4096–4096
border_handlingCOMBOedge4 options: edge, constant, reflect, symmetric
constant_colorCOLOR#000000
filter_typeoptCOMBObilinear6 options: nearest, box, bilinear, hamming, bicubic, lanczos
stretch_xoptFLOAT1.000.001–10
stretch_yoptFLOAT1.000.001–10
use_normalizedoptBOOLEANfalseIf true, transform values are scaled to image dimensions.

Outputs (1)

NameTypeDescription
IMAGEIMAGE