- LoadGifFrames: loads GIF via Pillow (no OpenCV/FFmpeg), deduplicates identical frames using MD5 hash, outputs unique_frames batch + frame_map JSON for reconstruction. Alpha channel composited over white background. - RemapGifFrames: decompressor node that expands deduplicated processed frames back to full sequence using frame_map. - BatchToImageList: splits IMAGE batch [N,H,W,C] into list of N individual frames so ComfyUI iterates the pipeline per-frame, avoiding RAM spikes on VAE encode/decode with large GIF batches. - js/load_gif_frames.js: upload widget for LoadGifFrames accepting .gif only.
29 lines
841 B
Python
29 lines
841 B
Python
import torch
|
|
|
|
|
|
class BatchToImageList:
|
|
"""Splits an IMAGE batch [N,H,W,C] into a list of N individual frames.
|
|
ComfyUI will iterate over the list, running each frame through the pipeline
|
|
independently — avoiding RAM spikes from large batches in VAE encode/decode.
|
|
Use ImageListToBatch+ downstream to collect results back into a batch.
|
|
"""
|
|
|
|
@classmethod
|
|
def INPUT_TYPES(cls):
|
|
return {
|
|
"required": {
|
|
"images": ("IMAGE",),
|
|
}
|
|
}
|
|
|
|
RETURN_TYPES = ("IMAGE",)
|
|
RETURN_NAMES = ("image",)
|
|
OUTPUT_IS_LIST = (True,)
|
|
FUNCTION = "split"
|
|
CATEGORY = "image"
|
|
TITLE = "Batch to Image List"
|
|
|
|
def split(self, images):
|
|
# images: [N, H, W, C] → list of N tensors [1, H, W, C]
|
|
return ([images[i:i+1] for i in range(images.shape[0])],)
|