Nodes/Comfy Pro Alpha Generator/Load Plate Sequence
ComfyUI Node

Load Plate Sequence

EXR Numbering Without the Rename Dance

By rik-python·Created about a month ago·Updated 9 days ago· 50
Load Plate Sequence
    • images
    • fps
    • first_frame
    ◄path►
    ◄fps24.000►
    ◄first0►
    ◄last0►

    If you have ever tried to feed plate.1001.exr through plate.1247.exr into ComfyUI, you know the ritual: copy the folder, rename everything to frame_00001.png, lose the original numbering, render, then try to remember which output frame corresponds to which plate frame. A compositor wrote this node specifically to end that, and it's the one node in this pack that isn't hidden - you'll find it under the Comfy Compositing category, not /internal.

    It does one job: turn a folder of frames into an IMAGE batch, and carry the plate's frame numbers through to the other end so the matte comes out as alpha_01001 and lines up in Nuke without a retime.

    How it works

    path takes either a folder (D:/plates/sh010) or a pattern (plate.####.exr or plate.%04d.exr). Relative paths resolve against ComfyUI/input. The node stats the directory, builds a regex from your pattern (#### and %04d both become \d+), collects every image file that matches, and sorts by the frame number parsed out of the filename - the trailing digit run, not the string. That last part matters more than it sounds: string sorting puts frame_999.exr after frame_1000.exr, and half of everyone's mystery "the matte drifts halfway through the shot" bug reports start there.

    first and last filter by frame number, not index. 0 means "from the start" / "to the end", so the defaults do nothing, which is the behaviour you want on a first pass.

    Every frame goes through a small cv2.imread wrapper. EXR is treated as scene-linear and converted with the sRGB curve, then clipped - LTX alpha-gen and SAM 3 both want display-referred images, and if you skip that conversion your plate comes out washed out and slightly wrong in a way that's hard to attribute later. 16-bit PNG and TIFF get shifted down to 8-bit. Grayscale is promoted to RGB.

    The frame reading is wrapped in a progress bar and the whole file list is cached, keyed on the folder's mtime. Change what's in the folder and the cache invalidates; leave it alone and re-queues are instant.

    Inputs and outputs

    Four inputs, all required: path, fps (default 24, and yes it just passes through - nothing reads the timecode), first, last.

    Three outputs, and the third is the interesting one: images is the batch, fps is the float you wired in, and first_frame is the number of the first file actually loaded. Wire first_frame into the generator node's first_frame input and your whole output sequence keeps the plate's numbering for free. That's the entire point of the node; if you skip that wire you get alpha_00001 on a plate that starts at 1001 and you're back to retiming.

    Load Plate Sequence ──images──────► Comfy Pro Alpha Generator (images)
            ├─────────────fps─────────► (fps)
            └─────────────first_frame─► (first_frame)
    

    Install

    Comes with the pack, no extra dependency beyond the pack's own requirements (opencv-python-headless is what does the frame reading, and it's in requirements.txt). Manager → Install via Git URL with https://github.com/rik-python/ComfyUI-Comfy-Pro-Alpha-Generator.git, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/rik-python/ComfyUI-Comfy-Pro-Alpha-Generator.git
    pip install -r ComfyUI-Comfy-Pro-Alpha-Generator/requirements.txt
    

    Restart ComfyUI. To actually matte anything you also need ComfyUI-SAM3, ComfyUI-LTXVideo and the LTX-2.5 models - see the pack's install section for the whole list.

    What goes wrong

    no images found for <path> and image sequence folder not found come from validate_inputs, so you get them at queue time with the path echoed back, not a half-render. Nine times out of ten the path is the problem: Windows backslashes work but need to be the real path, and a relative path is relative to ComfyUI/input, not to where your .json lives.

    Files with no digits in the name get None as their frame number and sort to the front. Harmless, unless every frame is render.png.

    One thing to plan around rather than fight: the generator tracks forward from the frame you click. If you load a 400-frame sequence and pick the subject on frame 150, frames 1–149 come out empty. Either set first to the frame you intend to pick on, or pick earlier.

    CategoryComfy Compositing

    Inputs (4)

    NameTypeDefaultDescription
    pathSTRINGFolder of frames, or a pattern: D:/plates/sh010/plate.####.exr (or %04d). Absolute, or relative to ComfyUI/input.
    fpsFLOAT24.0001–240—
    firstINT0First frame NUMBER to load (0 = from the start)
    lastINT0Last frame NUMBER to load (0 = to the end)

    Outputs (3)

    NameTypeDescription
    imagesIMAGE—
    fpsFLOAT—
    first_frameINT—