Cut And Drag On Path
The After Effects trick, but inside ComfyUI
- image
- mask
- bg_image
- image
- mask
Some of the best motion-control results in local video generation right now start with a deliberately crude edit: cut an object out of a photo, drag it to a new spot, and hand that rough, physically-wrong composite to a video model as a hint about where things should move. People have been doing this by hand in Adobe After Effects - cutting a car out of a still and manually keyframing it across the frame before feeding the sequence into Wan. Cut And Drag On Path does the exact same operation natively in ComfyUI: no separate editor required.
Why this specific trick matters
This isn't a generic compositing gimmick - it's the prep step behind Time-to-Move (TTM), a motion-control technique that went viral on r/StableDiffusion for how well it worked on Wan 2.2. The idea: you don't need a perfect edit, just a rough one that shows the model where an object should end up; a TTM-style model patch then uses that crude motion as guidance during early denoising and lets the model clean it up into physically coherent movement. The bottleneck was always producing that rough cut-and-drag video in the first place - which is why people were reaching for full video-editing software just to move a cutout across a few frames. This node removes that dependency.
How it works
Give it an image and a mask marking the object you want to move, plus a coordinates path describing where it travels. The node cuts the masked region out and drags it along that path frame by frame, building a batch sized to frame_width/frame_height. What happens to the hole left behind depends on your setup: supply a bg_image and the cutout composites over it at each position; leave bg_image empty with inpaint left on (the default) and the gap gets filled automatically using OpenCV's TELEA algorithm - a well-established, fast inpainting method that fills a hole by propagating nearby pixel information inward, no diffusion model involved.
The inputs and outputs that matter
imageandmask(required) - your source and the region to cut and drag.coordinates(STRING) - the path the cutout travels along.frame_width/frame_height(default 512, 16–4096) - output frame size for the resulting sequence.inpaint(default true) - fill the vacated area with TELEA inpainting when no background is supplied.bg_image(optional) - composite the moving cutout over this instead of inpainting the hole.- Outputs:
image(the frame sequence) andmask(tracking the cutout's position per frame - genuinely useful downstream if a later node needs to know exactly where the moved object is at each step, such as a TTM-style guidance mask).
Installing it
Ships with the pack:
- ComfyUI Manager - search KJNodes for ComfyUI, install, restart.
- Manual -
cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-KJNodes, thenpip install -r ComfyUI-KJNodes/requirements.txt, restart.
No models to download for this node specifically - TELEA inpainting runs through OpenCV, a standard dependency, not a checkpoint.
Common issues & troubleshooting
The inpainted background looks rough or smeared. That's TELEA doing what a fast, non-generative inpainting algorithm does - it's built for speed and plausibility on simple backgrounds, not for reconstructing fine detail. For a clean, complex background, supplying your own bg_image will beat TELEA every time; save the auto-inpaint for quick tests or simple, low-detail backdrops.
The output looks like a rough, obviously-composited edit. That's expected, and it's the whole point of this technique - you're not trying to produce a finished-looking video here, you're building the crude motion hint that a downstream model (like a TTM-style patch) is meant to clean up. Judge the output by whether the path and timing are right, not by whether it looks polished on its own.
Cutout doesn't line up with my intended path. Double-check your mask actually isolates the object you mean to move - a mask that's too loose or too tight will drag extra background or clip part of the subject along with it, which shows up as artifacts at the edges of the moving region.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| coordinates | STRING | — | |
| mask | MASK | — | |
| frame_width | INT | 51216–4096 | — |
| frame_height | INT | 51216–4096 | — |
| inpaint | BOOLEAN | true | — |
| bg_imageopt | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |