Nodes/GraftingRayman/GR Pan Or Zoom
ComfyUI Node

GR Pan Or Zoom

Ken Burns effect for ComfyUI, with an optional depth-aware parallax mode

By GraftingRayman·Created 2 years ago·Updated about a month ago· 76
GR Pan Or Zoom
  • images
  • depth_maps
  • poz_frames
zoom1.5
frames_per_transition24
modepan-left
use_depthfalse
depth_focus_methodweighted-average
max_depth10.0
parallax_strength0.5
devicecuda
randomizefalse

This node turns a still image into a sequence of frames that pan or zoom across it - the classic "Ken Burns" move you've seen in every documentary and slideshow tool. What makes it more than a basic crop-and-scale-across-frames node is the optional depth mode: feed it a depth map alongside the image and it can do actual parallax, where nearer parts of the scene shift more than distant ones as the "camera" moves, instead of the whole image just sliding or scaling uniformly.

That distinction matters. A flat pan or zoom looks like exactly what it is - a still photo being cropped differently over time. Real parallax, where foreground and background move at different rates, is what sells the illusion that the camera is actually moving through a 3D scene. This is the same idea behind dedicated parallax tools like DepthFlow, just built as a node you can wire directly into a ComfyUI graph instead of reaching for a separate app.

How it works

Without use_depth, it's a straightforward pan or zoom: mode picks the direction (pan-left, pan-right, pan-up, pan-down, zoom-in, zoom-out), zoom sets how far it pushes in, and frames_per_transition controls how many frames the motion is spread across - more frames means smoother, slower motion for the same total travel. With use_depth on and a depth_maps input connected, the node instead displaces pixels based on depth: near objects move more, far ones move less, producing genuine parallax rather than a flat slide. depth_focus_method decides how the node figures out where to "focus" the effect within the depth map (options like centroid, max-point, weighted-average), and parallax_strength scales how aggressive the depth-based displacement is.

Worth knowing going in: the depth map only describes what the camera originally saw. As a parallax effect pushes the virtual viewpoint sideways, it reveals areas that were never captured - there's no pixel data there. Keep parallax_strength modest, or plan on inpainting the gaps if you push it further; this is a known hard limit of every technique in this family, not something specific to this node.

The inputs and outputs that matter

  • images - your source image (or batch).
  • depth_maps - required by the schema even when use_depth is off, though it only actually affects the output in depth mode. Depth Anything V2 is the standard, current choice for generating one if you don't already have it.
  • mode - direction of travel; default is pan-left.
  • zoom (default 1.5, up to 5) and frames_per_transition (default 24, up to 1200) - how far and over how many frames.
  • use_depth - flips the effect from a flat pan/zoom to depth-aware parallax.
  • depth_focus_method and parallax_strength (default 0.5) - only relevant with use_depth on; tune strength conservatively first.
  • device (cpu/cuda) - depth-based warping is meaningfully faster on GPU for longer sequences.

One output: poz_frames, an IMAGE batch - feed it straight into a video-combine node to get an actual video out.

How to install it

ComfyUI Manager, search GraftingRayman. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/GraftingRayman/ComfyUI_GraftingRayman

Restart. This pack requires OpenAI's CLIP as a separate install or nothing imports - portable: .\python_embeded\python.exe -m pip install git+https://github.com/openai/CLIP.git; system Python: pip install git+https://github.com/openai/CLIP.git.

Common issues & troubleshooting

Pack fails to import. Check startup console for the CLIP error, run the pip command above.

Depth mode produces visible tearing or warped-looking edges. You've pushed parallax_strength far enough to reveal regions with no source pixel data. Back it off, or accept the artifact if it's subtle enough not to matter for your shot.

Generation is slow with a lot of frames. frames_per_transition goes up to 1200 - that's a lot of frames to compute, especially in depth mode on cpu. Switch device to cuda if you have a GPU available, and consider whether you actually need that many frames for a smooth result.

Flat pan/zoom mode looks fine but depth mode does nothing. Confirm use_depth is actually enabled and that a real depth map (not a blank or solid-color image) is wired into depth_maps - a flat depth map has nothing to parallax against.

CategoryGraftingRayman/Video

Inputs (11)

NameTypeDefaultDescription
imagesIMAGE
depth_mapsIMAGE
zoomFLOAT1.51.1–5
frames_per_transitionINT241–1200
modeCOMBOpan-left6 options: pan-left, pan-right, pan-up, pan-down, zoom-in, zoom-out
use_depthBOOLEANfalse
depth_focus_methodCOMBOweighted-average6 options: centroid, max-point, adaptive-region, weighted-average, smoothed, weighted-singular
max_depthFLOAT10.01–100
parallax_strengthFLOAT0.50.1–1
deviceCOMBOcuda2 options: cpu, cuda
randomizeBOOLEANfalse

Outputs (1)

NameTypeDescription
poz_framesIMAGE