Nodes/Dream Project Animation Nodes/πŸ’Ύ Image Sequence Loader
ComfyUI Node

πŸ’Ύ Image Sequence Loader

Load frame N back into the graph β€” the loop that keeps Deforum-style renders coherent

By alt-key-projectΒ·Created 3 years agoΒ·Updated 2 years agoΒ· 114
πŸ’Ύ Image Sequence Loader
  • frame_counter
  • default_image
  • image
  • frame_name
β—„directory_pathβ–Ί
β—„pattern*β–Ί
β—„indexingβ–Ύβ–Ί

The core loop of Deforum-style animation is "render frame N, feed it back in as the starting image for frame N+1." Image Sequence Loader [Dream] is the half of that loop that reaches back into the folder of already-rendered frames and pulls the right one out. If you've ever built a frame-by-frame animation in ComfyUI you've hand-rolled this node's job with a dozen Load Image nodes and a file-name hack; this does it in one.

It's part of the Dream Project Animation Nodes pack - a frame-by-frame animation toolkit from 2023 by qaozmojo, the "Alt Key Project" music channel. The pack is no longer actively updated (the author moved to comfyui-dream-video-batches), but the loader is still one of the cleanest ways to do the frame feedback loop.

How it works

You feed it a frame_counter plus a directory_path and a pattern (default *). It scans the directory, builds a map of frame number β†’ image file(s), and returns whatever image matches the counter's current frame. Two details are worth knowing:

  • indexing: numeric reads the trailing digits from each filename (frame_0042.png β†’ 42); alphabetic order just sorts filenames and numbers them in sequence. If your renderer writes zero-padded numbered files, numeric is what you want.
  • Sub-batches: if it finds batch_0001, batch_0002… subdirectories it scans those in order, so it handles the way this pack's Image Sequence Saver lays things out.

The output is an image plus a frame_name STRING (the basename of the file it loaded), which is handy for logging or filename-based conditionals.

The one input people miss is default_image (optional). When there's no file for the current frame - frame 0, or a gap - the node returns this instead of nothing. Wire a static image here and your very first frame still has something to process instead of blowing up the graph.

Wiring it in

The classic pattern: Frame Counter (Simple or Directory) β†’ Image Sequence Loader β†’ VAE encode β†’ sampler β†’ save. The loader gives you the previous rendered frame as the img2img base, so the animation stays anchored to what actually came before it. IS_CHANGED is a constant NaN in the source, which means ComfyUI always re-runs the node - you don't get stale-cache surprises mid-render.

Installing and notes

cd ComfyUI/custom_nodes
git clone https://github.com/alt-key-project/comfyui-dream-project.git

Or install via ComfyUI Manager under "Dream Project Animation". It's pure Python - imageio, scipy, torchvision, and friends - no model downloads. Watch out for the pack's numpy<2.0 pin if another node pack wants NumPy 2. Find it under Dream β†’ image β†’ animation.

Category✨ Dream/πŸŒ„ image/πŸŽ₯ animation

Inputs (5)

NameTypeDefaultDescription
frame_counterFRAME_COUNTERβ€”
directory_pathSTRINGβ€”
patternSTRING*β€”
indexingCOMBO2 options: numeric, alphabetic order
default_imageoptIMAGEβ€”

Outputs (2)

NameTypeDescription
imageIMAGEβ€”
frame_nameSTRINGβ€”