Nodes/comfyUI_LLM/📂 加载本地GIF
ComfyUI Node

📂 加载本地GIF

An animated GIF becomes a frame batch — with a catch about channels

By XieJunchen·Created about a year ago·Updated about a month ago· 2
📂 加载本地GIF
    • images
    pathyour_local_gif_path.gif

    GIFs are a surprisingly common source of motion reference - people animate stuff with them, and image-to-video models love a frame sequence to start from. ComfyUI's built-in loaders handle static images and videos, but an animated GIF lands awkwardly. This node, "📂 加载本地GIF", cracks the GIF open frame by frame and hands you the whole thing as an IMAGE batch, ready for a video model, an img2img pass, or per-frame processing.

    How it works

    Pillow does the heavy lifting. The node opens the file with Image.open(path), then iterates im.n_frames, seeking to each frame and converting it to RGBA. Every frame becomes a float32 tensor in [0,1], and they all get stacked into a single (N, H, W, C) batch - frame count first, then height, width, channels. Output is images (IMAGE).

    Inputs and output

    One input, one output:

    • path (STRING) - where the GIF lives. Typed path, not a picker, resolved relative to where ComfyUI runs. Absolute paths avoid the classic "can't find it" dance.
    • Output: images (IMAGE) - all frames in one batch.

    The catch: RGBA

    Here's the gotcha the README won't tell you. The code converts every frame to RGBA - four channels - because GIFs support transparency. That means the output batch is 4-channel, and a lot of ComfyUI nodes (VAE encode, most image ops) expect 3-channel RGB. You'll see channel-mismatch errors downstream and wonder what's wrong.

    Two fixes, both inside this pack:

    • Wire the output through CreateEmptyImageBatch, whose hidden talent is stripping alpha to plain RGB.
    • Or just don't feed it into nodes that care - some processors tolerate RGBA.

    Either way, know that "loads fine, errors downstream" with this node usually means channels.

    Installing it

    Standard pack install - ComfyUI Manager → search comfyUI_LLM, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/XieJunchen/comfyUI_LLM
    # restart ComfyUI
    

    Pillow and torch, both already in the pack's requirements.txt.

    Other things worth knowing

    • Frame count is your video length. A 30-frame GIF at 30 fps is one second of motion - check N before you feed it to a video model that expects a specific frame count.
    • File paths, not directory paths. One GIF per node. For a folder full of them, you'd loop the node or use a batch loader instead.
    • It's the local counterpart to LoadImgFromUrl - that one fetches a single remote image; this one loads a local animated sequence. Different jobs, same pack.

    If a GIF is your source of truth for motion, this is the fastest way to turn it into something ComfyUI can actually work with. Just mind the alpha channel.

    Category本地文件

    Inputs (1)

    NameTypeDefaultDescription
    pathSTRINGyour_local_gif_path.gif

    Outputs (1)

    NameTypeDescription
    imagesIMAGE