ComfyUI Node

Move In_Or_Out

Fake a dolly zoom — by moving the background, not the camera

By Isi-dev·Created 2 years ago·Updated 10 months ago· 33
Move In_Or_Out
  • foreground_images
  • background_image
  • IMAGE
  • MASK
scaling_factor2.00
move_infalse
fg_x_offset0
fg_y_offset0

The name tells you exactly what it fakes: the illusion of moving into or out of a place. You feed it a foreground subject cut out of its background plus a background image, and it produces a batch of composited frames where the environment appears to zoom toward or away from the camera. It's the "dolly" node of the pack, and it's the classic parallax-with-extra-steps trick.

Here's the mechanism, straight from the source. The node takes your background and resizes it up to scaling_factor× its original size (default 2×, up to 20×). Then for each frame it interpolates the background size between the original and the max, resizes, and crops a centered window back down to the original resolution. Because the crop window effectively shrinks or grows each frame, the world appears to rush at you or away from you. Flip move_in to true and the sequence reverses - zooming in instead of out.

The honest detail nobody puts in the marketing: only the background moves. Your foreground is composited at a fixed size, dead center (or nudged by the offsets). That's fine - zooming the background out while the subject stays put is exactly what reads as "the subject is receding." If you want the subject to grow with the zoom, you'd scale it separately before wiring it in.

Inputs that matter

  • foreground_images - the subject, ideally as an RGBA cutout from a background-removal node (the pack's own workflows use InspyrenetRembg here). A plain RGB image has no alpha and composites as a solid rectangle.
  • background_image - the scene. Can be a single image; it's reused across all frames.
  • scaling_factor - how much the background zooms (1.5–20, default 2). Higher = more dramatic travel.
  • move_in - false = moving out (default), true = moving in.
  • fg_x_offset / fg_y_offset - nudge the subject around the frame. One quirk worth knowing: in the current code a positive fg_y_offset is ignored - only negative values (shift up) take effect. fg_x_offset works both ways.

Outputs are IMAGE (one frame per foreground frame) and MASK - and the mask is an all-zero placeholder, a habit this pack leans on. Don't rely on it.

Installing it

One of eight nodes in ComfyUI-Animation_Nodes_and_Workflows by Isi-dev:

  • ComfyUI Manager → search ComfyUI-Animation_Nodes_and_Workflows → install, restart.
  • Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/Isi-dev/ComfyUI-Animation_Nodes_and_Workflows
cd ComfyUI-Animation_Nodes_and_Workflows
pip install -r requirements.txt

All CPU-side OpenCV/numpy math - no model downloads, no GPU requirement. The mediapipe in requirements is for the pack's LivePortrait node, not this one.

Common gotchas

  • Feed it a clean cutout or the illusion dies at the edges. If you see a hard rectangle, the problem is upstream - your background-removal node didn't deliver alpha.
  • The pack ships object_move_in_or_out.json and portrait_walk_in_or_out.json showing the intended chain: cut out subject → MoveInOrOut → VHS_VideoCombine. Load those and tear them apart.
  • At high scaling_factor with few frames, the zoom per frame gets jumpy. More frames (or a lower factor) smooths it.

It's a surprisingly effective node for something that's just cv2.resize in a loop. If you need a fake camera push-in for a product, a character, or a walk cycle, this is the one to reach for in this pack.

Categoryimage

Inputs (6)

NameTypeDefaultDescription
foreground_imagesIMAGE
background_imageIMAGE
scaling_factorFLOAT2.001.5–20
move_inBOOLEANfalse
fg_x_offsetINT0-16384–16384
fg_y_offsetINT0-16384–16384

Outputs (2)

NameTypeDescription
IMAGEIMAGE
MASKMASK