Smart Load GIF Image
Load GIF frames with alpha, masks, and first/last shortcuts
- all_images
- all_masks
- first_frame
- first_mask
- last_frame
- last_mask
- custom_frame
- custom_mask
GIFs are the forgotten format of AI video work - they're everywhere as references and test clips, but ComfyUI's built-in loaders treat them as a single image, not a frame sequence with transparency. Smart Load GIF Image is the loader that gets GIFs right: it splits every frame, preserves the alpha channel as both RGBA output and a mask, and hands you first/last/any-frame shortcuts without you having to slice the batch yourself.
How it works
It walks the GIF with Pillow's ImageSequence iterator and does three things per frame that most loaders skip:
- Transparency is real. Frames with an alpha channel come out as RGBA and as a matching mask (transparent areas → white, the same inverted-alpha convention the rest of the pack uses). Palette-based GIF transparency (
Pmode with a transparency index) is converted to RGBA too, so no silent color corruption. - Size filtering. Frames that don't match the first frame's dimensions are skipped rather than dumped into the batch at mixed sizes - GIFs with partial-frame updates don't break your downstream ops.
- Frame shortcuts. Instead of always handing you the whole stack, it also outputs
first_frame/first_maskandlast_frame/last_mask, plus acustom_frame/custom_maskat any index you set. For image-to-video work, grabbing the first frame as a seed is one wire, not a slice node.
The image input is a path string, not the usual dropdown - the code comment says that's deliberate, so API clients and absolute paths work. It accepts a full filesystem path or a Comfy input-folder-relative path, and it hashes the file content so ComfyUI actually re-runs when the file changes (GIF loaders that cache by filename will show you stale frames forever otherwise).
Inputs and outputs
image- path to the GIF file.custom_frame- index (0-based) for the custom-frame outputs.
Outputs: all_images, all_masks, first_frame, first_mask, last_frame, last_mask, custom_frame, custom_mask.
Installing it
Same pack as the rest:
cd ComfyUI/custom_nodes
git clone https://github.com/slvslvslv/ComfyUI-SmartImageTools
pip install -r ComfyUI-SmartImageTools/requirements.txt
Restart ComfyUI, or install "SmartImageTools" via ComfyUI Manager. It leans on Pillow, which is already in the pack requirements.
The one thing to know
The path input means you type the file location instead of picking from a list - that's the trade for supporting absolute paths, and it's honestly the right call for automation. And if you load a frame-capped GIF, remember the masks are there for a reason: the whole point of this node is handing an animated reference to video models with its alpha intact.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | STRING | — | |
| custom_frame | INT | 00–1000 | — |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| all_images | IMAGE | — |
| all_masks | MASK | — |
| first_frame | IMAGE | — |
| first_mask | MASK | — |
| last_frame | IMAGE | — |
| last_mask | MASK | — |
| custom_frame | IMAGE | — |
| custom_mask | MASK | — |