Smart Gradient Deformation
Warp your image with a gradient you can actually see
- image
- image
- gradient
Most image warping in ComfyUI means slapping a ControlNet or a distortion model on it. Smart Gradient Deformation takes the boring, deterministic route: it shifts rows or columns of pixels by a displacement profile and gives you a second output so you can see the displacement you just applied. It's the kind of node that's perfect for subtle motion, wobble, or skewing effects you want exact control over rather than "let the model decide."
How it works
Pick vertical or horizontal. The node builds a 1D displacement ramp between start_pos and end_pos (both 0–1 positions along the image), raises it to an exponent, and scales it by offset pixels. Then it remaps the image with OpenCV - shifting rows down or columns sideways by that amount - and replicates edge pixels so you don't get ugly black borders at the frame edges.
The exponent is what makes it expressive. At 1.0 you get a linear shear; crank it up and the displacement concentrates toward one end, which reads as an accelerating warp or a pushed-perspective feel. The offset is the raw strength in pixels; negative values flip the direction.
The second output, gradient, is a grayscale image visualizing the displacement map - where the shift is small it's dark, where it's large it's bright. That's a genuinely nice touch: it's how you debug what the node is doing without blind iteration, and it doubles as a texture you could feed elsewhere.
Inputs and outputs
image- theIMAGEto deform.type-verticalorhorizontal.start_pos/end_pos- 0–1 positions bounding the displacement ramp (auto-swapped if you put them backwards).offset- displacement strength in pixels (−8192 to 8192).exponent- ramp shape, 0.01–10.
Outputs: image (the warped result) and gradient (the displacement visualization).
Installing it
It's in the ComfyUI-SmartImageTools pack:
cd ComfyUI/custom_nodes
git clone https://github.com/slvslvslv/ComfyUI-SmartImageTools
pip install -r ComfyUI-SmartImageTools/requirements.txt
Restart ComfyUI (or ComfyUI Manager → "SmartImageTools"). OpenCV does the heavy lifting, so the pack's shared install covers it.
Real talk
This is a niche node and I'll be honest about its limits: it's a 1D displacement, not a free-form warp, so you get shears, slopes, and wobbles - not arbitrary morphing. It also has no animation built in, so if you want a video wobble you'd run it per-frame on a video batch. But for the one job it does - a clean, controllable, visible gradient deformation - it's tight, deterministic, and zero-VRAM. Pair the gradient output with a preview and you'll dial in exactly the skew you want in a couple of tries.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| type | COMBO | 2 options: vertical, horizontal | |
| start_pos | FLOAT | 0.000–1 | — |
| end_pos | FLOAT | 1.000–1 | — |
| offset | INT | 20-8192–8192 | — |
| exponent | FLOAT | 1.000.01–10 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| gradient | IMAGE | — |