ComfyUI Node

Load GIF Frames (Raw)

Load a GIF's unique frames and the map to rebuild the full sequence

By marcoc2·Created 2 years ago·Updated 5 months ago· 1
Load GIF Frames (Raw)
    • unique_frames
    • frame_map
    • unique_count
    • total_frames
    gif
    repetition_count1

    Load GIF Frames (Raw) is the "don't waste GPU time on frames that repeat" loader. GIFs are full of duplicate frames - the format is built on them - and if you're piping a GIF into a video or frame-interpolation pipeline, processing the same pixel-identical frame eight times is pure waste. This node reads the GIF from your input folder, flattens every frame onto a white background, hashes them to find which ones are truly identical, and hands you the unique frames plus a map that tells you how to rebuild the original sequence.

    The mechanism is where the cleverness lives. Each frame is composited over white (so alpha gets handled), then MD5-hashed; identical hashes collapse into a single stored frame. You get four outputs: unique_frames (the deduplicated batch), frame_map (a JSON string like [0,0,1,2,2,1] that indexes the full sequence into the unique set), unique_count, and total_frames. The repetition_count input (1–100) extends the map so the sequence loops N times - handy if you're building a longer animation from a short GIF and want the map to match your target length.

    The full-loop design becomes clear with the pack's companion node, RemapGifFrames: you run the unique frames through your processing pipeline - upscaling, inpainting, whatever - and then RemapGifFrames takes the processed frames plus the frame_map and reconstructs the complete, correctly-ordered sequence. That's the intended workflow: process only the unique work once, then reassemble. It's a genuinely thoughtful design for batch efficiency, the kind of thing you only appreciate after paying for duplicated frame processing once.

    Practical gotchas. The gif input is a dropdown populated from .gif files in ComfyUI's input folder (with upload), so drop the file there first or use the upload picker - unlike the path-string loaders in this pack, it's a proper picker. The white-flattening means transparency is gone, which matters if your GIF relies on alpha compositing between frames - a GIF that animates by layering partial frames will have been composited by PIL before you see it, so "raw" is doing a lot of work in that name. And if you process unique frames and the count doesn't line up (say a downstream node drops one), RemapGifFrames will refuse with a clear error telling you exactly how many frames it expected - annoying when it happens, but a genuinely helpful failure mode compared to most node packs.

    It's a small utility with a narrow lane, but if your workflow is GIF → enhance → back to GIF, it's the difference between processing the same frame six times and processing it once. Install: ComfyUI Manager → search "AnotherUtils", or cd ComfyUI/custom_nodes && git clone https://github.com/marcoc2/ComfyUI-AnotherUtils, then restart. No extra dependencies - PIL and hashlib are already there.

    Categoryimage/loaders

    Inputs (2)

    NameTypeDefaultDescription
    gifCOMBO0 options:
    repetition_countINT11–100Number of times to repeat the GIF frame sequence.

    Outputs (4)

    NameTypeDescription
    unique_framesIMAGE
    frame_mapSTRING
    unique_countINT
    total_framesINT