Nodes/YG Custom Nodes/YG ZIP Image Loader
ComfyUI Node

YG ZIP Image Loader

Feed a batch of images from a ZIP without the OOM

By mallikarjunaraokoliparthi·Created 2 months ago·Updated about a month ago· 0
YG ZIP Image Loader
    • image
    • mask
    • folder_name
    • filename
    • current_index
    • total_count
    • is_last
    job_idmy_zip_job

    This one exists because batch-loading a whole folder of images into ComfyUI at once is a great way to run out of VRAM. YG ZIP Image Loader is the calm version: you hand it a ZIP file, it extracts it, and then it hands your pipeline one image per queue run - no giant batched tensor, no OOM, no fuss. It's basically purpose-built for "run background removal on this whole folder" workflows, which is exactly how the author frames it: loader → BG remove → saver.

    How it works

    The node itself has a single input widget: a job_id. The "Upload ZIP File" button on the node is added by the pack's web extension - it opens your OS file picker, uploads the ZIP to the server, and extracts it while preserving any sub-folder structure inside. The extracted file list is kept in memory, keyed by job_id, and each queue run advances an index and returns the next image.

    The mechanism that makes it advance is the IS_CHANGED trick: the loader returns float("NaN") from its change check so ComfyUI's cache always sees it as dirty and re-executes it every run. The index wraps back to zero after the last image and is_last flips true, which is your signal that the batch is done. Because it outputs one IMAGE at a time, the VRAM footprint stays flat regardless of how many images are in the ZIP - that's the whole point.

    What you get out of it

    • image and mask - the current image (mask is inverted alpha, matching ComfyUI's Load Image behavior).
    • folder_name and filename - where the image sat inside the ZIP, which matters if you want to preserve that structure when saving. This is what lets a loader→saver pair round-trip a ZIP's subfolders exactly.
    • current_index, total_count, is_last - the batch bookkeeping. Wire is_last (and the others) into the saver so it knows when to finalize.

    The web UI also adds a progress bar and a "Run All" button that queues the whole batch for you.

    Installing it

    One of twelve nodes in comfyui_yg_nodes (MIT, by Mallikarjuna Rao Koliparthi, published to the Comfy Registry as "YG Custom Nodes" v1.0.4). No extra Python dependencies. Install through ComfyUI Manager (search comfyui_yg_nodes) or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/mallikarjunaraokoliparthi/comfyui_yg_nodes.git
    

    Restart ComfyUI; it's in the YG Custom Nodes menu.

    Where people get burned

    The classic failure is forgetting to click the upload button at all - the node raises "No ZIP loaded for job '...' - click the Upload ZIP File button first." Less obvious: the job state lives in memory, so restarting ComfyUI clears it and you have to re-upload. And the job_id is load-bearing: if you wire a saver with a different job_id, the two nodes are talking about different jobs entirely. Keep them identical. Also worth knowing: a ZIP with zero image files (PNG/JPG/WEBP/TIFF/BMP) will error, and giant ZIPs with thousands of images extract in one go, which takes a moment - the progress bar is there so it doesn't look hung.

    If your workflow does folder-style batches on the server side rather than browser uploads, check out the sibling node YG Local ZIP Image Loader, which reads a ZIP from ComfyUI's input folder instead.

    CategoryYG Custom Nodes

    Inputs (1)

    NameTypeDefaultDescription
    job_idSTRINGmy_zip_jobUnique job name. Must match the job_id in YG ZIP Image Saver. Use different names for different ZIP files.

    Outputs (7)

    NameTypeDescription
    imageIMAGE
    maskMASK
    folder_nameSTRING
    filenameSTRING
    current_indexINT
    total_countINT
    is_lastBOOLEAN