Nodes/WAS Node Suite v3/Load Image Sequence
ComfyUI Node Runs on cloud

Load Image Sequence

A numbered folder of frames, loaded as one batch

By WASasquatch·Created 3 years ago·Updated 4 days ago· 1,844
Load Image Sequence
    • images
    • count
    • filenames
    • image_list
    • filename_list
    folder
    pattern*
    num_frames16
    strategyuniform
    nth1
    seed0
    resize_modefit and pad
    width0
    height0
    start0
    end-1
    max_size1024
    interpolationlanczos
    alignmiddle center
    pad_color#000000
    channelsRGB

    Video work in ComfyUI usually starts with a folder full of numbered frames, and Load Image Sequence is the node that turns that folder into one batch. It reads in filename order, applies a range and a sampling strategy, resizes every frame to a common size, and hands you the whole run on a single IMAGE socket - the difference between this and Load Image Batch being that the batch version serves one frame per run, while this serves the run of frames a video pipeline wants. It defaults to 16 frames because a folder can hold thousands and a batch is one tensor in memory.

    The sampling controls

    • strategy - how num_frames are chosen from the range: uniform (evenly spaced), head, center, tail, random (seeded), or every_nth.
    • nth - a thinning step applied before the strategy picks, so head with nth 2 takes the opening on alternate frames.
    • num_frames - how many to keep. 0 takes every frame in range, up to the 4096 ceiling.
    • seed - matters only for random, so a re-run grabs the same frames.

    Here's the part that separates it from a dumb folder loader: only the chosen files are opened. Sample a 5,000-frame capture down to 16 uniform frames and the node reads sixteen files, not five thousand. The description makes the point deliberately - "sampling a long capture costs the frames you keep rather than all of them."

    Size and the round-trip outputs

    Frames of mixed sizes still have to stack, so resize_mode decides how each meets width/height: fit and pad (keeps the whole frame, pads the rest), fill and crop (fills and trims the overhang), stretch (distorts), crop or pad (never resamples). Leave width and height at 0 and the size comes from the first frame kept - with max_size capping the long edge so a folder of huge frames doesn't blow up memory.

    The real gem is the paired outputs. images and count are the batch and its length; filenames lists every loaded name. But image_list and filename_list hand you the same frames one at a time - image_list runs a downstream node once per frame, and filename_list pairs with Image Save's filename_prefix (extension dropped) so every frame is written back under its own name. That's the folder round-trip the README advertises: load a sequence, process it, save each frame with the name it came in with.

    Installing it

    Part of WAS Node Suite:

    cd ComfyUI/custom_nodes
    git clone https://github.com/WASasquatch/was-node-suite-comfyui.git
    

    or ComfyUI Manager → "WAS Node Suite v3", then restart. Requires ComfyUI 0.14.0+ and Python 3.10+; v3 installs no pip packages.

    Where people trip

    The memory surprise is the classic: wire a folder of 2,000 frames straight in at num_frames 0 and you've asked for one giant tensor - that's why the default is 16 and why max_size exists. Second, pattern matches inside the folder only, and filename order is lexical, so frame_10.png sorts before frame_2.png - pad your numbering (frame_02) or use start/end ranges rather than fighting the sort. And remember random is seeded per seed, not per run: leave the seed alone and "random" is deterministic, which is usually what you want for reproducible workflows.

    CategoryWAS Suite/IO

    Inputs (16)

    NameTypeDefaultDescription
    folderCOMBOWhich folder to read. A bare 'input', 'output' or 'temp' is that folder itself; 'plates/shot_01 [input]' is that folder below it. Any folder added under paths.allow_read in config.yaml is listed under its own name, and so are the folders inside it.
    patternSTRING*Which files to take, as a glob. `*` takes every image in the folder, `frame_*.png` takes one numbered run out of a folder holding several. Matching is inside the folder only.
    num_framesINT160–4096How many frames to keep, chosen by the strategy below. 16 by default, because a folder can hold thousands and a batch is one tensor in memory. 0 takes every frame in the range, up to the 4096 ceiling.
    strategyCOMBOuniformHow num_frames are chosen. uniform = evenly spaced; head = first; center = middle; tail = last; random = a seeded pick; every_nth = every nth. Only the chosen files are opened, so sampling a long capture costs the frames you keep rather than all of them.
    nthINT11–4096Step between the frames the strategy may choose from. 1 uses every frame; 2 thins to every other one first, so `head` takes the opening of the clip on alternate frames. It applies to every strategy.
    seedINT00–18446744073709550000Seed for random, so a re-run keeps the same frames. Ignored by the other strategies. Any whole number; `0` is as good a seed as any.
    resize_modeCOMBOfit and padHow each frame meets the size below, so a folder of mixed sizes still stacks. `fit and pad` keeps the whole frame and pads the rest, `fill and crop` fills the size and trims the overhang, `stretch` distorts to fit, `crop or pad` never resamples.
    widthINT00–16384Width every frame is brought to. 0 takes the width of the first frame kept, which is what loads a sequence at its own size.
    heightINT00–16384Height every frame is brought to. 0 takes the height of the first frame kept.
    startoptINT0-4096–4096First file to consider, counting from 0 through the matching files in filename order. Negative counts back from the end.
    endoptINT-1-4096–4096Last file to consider, inclusive. -1 is the final file, which is the whole sequence together with a start of 0.
    max_sizeoptINT10240–16384Longest edge the derived size is held to, keeping the aspect. Only read when width and height are 0, which is where a folder of large frames would otherwise fill memory. 0 lifts the cap.
    interpolationoptCOMBOlanczosResampling filter. `lanczos` is the sharpest for a downscale.
    alignoptCOMBOmiddle centerWhich part of a frame survives a crop, and which side carries the wider bar of a pad.
    pad_coloroptSTRING#000000Fill for space a frame does not cover. Any Pillow colour.
    channelsoptCOMBORGBChannels the batch carries. `RGBA` keeps the pad transparent.

    Outputs (5)

    NameTypeDescription
    imagesIMAGEThe sequence as one batch, in filename order.
    countINTHow many frames the batch holds once the range and the strategy have been applied.
    filenamesSTRINGThe filename of each loaded frame, in order, one per line.
    image_listIMAGEThe same frames as one image each rather than one batch, so a node wired here runs once per frame. Pair it with filename_list to put every frame through Image Save under its own name.
    filename_listSTRINGOne name per frame, in the same order as image_list, with the extension dropped so it can be wired straight into Image Save's filename_prefix. Image Save adds the extension it writes.