Comfyui-LoopLoader

Comfyui-LoopLoader
★ 3

顺序加载循环读取透明通道掩码返回torch张量
按顺序从目录逐张加载图片(每次一张),支持常见格式并提取透明通道为掩码,末尾自动循环,输出torch张量、掩码和文件路径。
💡 用于按序为ComfyUI流水线逐帧提供图像、掩码和路径进行处理。
🍴 2 Forks💻 Python🔄 2025-02-21
📦
网盘下载
复制链接后前往夸克网盘下载
https://pan.quark.cn/s/8b0992d318c3
📄 README

📂 LoadLoopImagesFromDir – ComfyUI Node

A ComfyUI custom node for loading images sequentially from a directory.

🔹 Features

  • Loads one image per call, automatically moves to the next.
  • Loops back to the first image when reaching the end.
  • Supports .jpg, .jpeg, .png, .webp formats.
  • Extracts masks from images with alpha channels.
  • Returns a torch tensor image, mask, and file path.

  • 🛠 Node Inputs

    | Name | Type | Default | Description |

    |————-|——–|———|————-|

    | directory | String | "" | Path to folder with images. |

    | load_always | Boolean | False | Forces reload every call. |

    📤 Node Outputs

    | Name | Type | Description |

    |———–|————|————-|

    | IMAGE | Tensor | Loaded image as a torch tensor. |

    | MASK | Tensor | Mask (alpha channel) or blank mask. |

    | FILE PATH | String | Full path to the loaded image. |


    🔄 How It Works

  • Reads all valid images in the directory.
  • Sorts the list alphabetically.
  • Loads the next image each time the node runs.
  • Loops back to the first image when reaching the end.
  • Returns the image, mask, and path.

  • 🏗 Installation

    1️⃣ Make sure ComfyUI is installed.

    2️⃣ Clone this node in the custom_nodes folder.

    “`

    git clone https://github.com/alessandrozonta/Comfyui-LoopLoader.git

    “`

    3️⃣ Restart ComfyUI.


    ⚠️ Errors & Debugging

  • Directory not found → Check the folder path.
  • No images found → Ensure there are valid image files.
  • Mask is empty → Only images with alpha channels will have masks.

  • 🔧 License & Contributions

  • License: GPL-3.0
  • Contribute: Open a pull request!
  • Issues: Report bugs on GitHub.