Nodes/feidorian-ComfyNodes/FD Workflow Image Loader Advanced
ComfyUI Node

FD Workflow Image Loader Advanced

A folder of images becomes a queue ComfyUI works through, one at a time

By Feidorian·Created 3 years ago·Updated 7 months ago· 5
FD Workflow Image Loader Advanced
    • image
    • mask
    • prompt_text
    selection_moderandom

    The idea behind this one is genuinely clever, and nothing else in the pack does it. Instead of you babysitting a loop, you dump a pile of images into a folder and every time you hit Queue the node hands you the next image as a proper IMAGE plus mask plus prompt text, you run it through whatever img2img or processing pipeline you built, and the matching saver writes the result back out. It's a queue, except the queue is a directory. Feed the same graph over and over and it eats the folder one image per run.

    Feidorian_WorkflowImageLoaderAdvanced is the front half of that system, from the archived feidorian-ComfyNodes pack (everything in it is prefixed "FD"). It's the batch-processing half of the pack, and it's the part worth caring about.

    Where it looks. There's no directory input on this variant - it watches a fixed folder, ComfyUI/output/WORKFLOW_IMAGES_ADVANCED, which the pack creates on first load along with APPROVED_IMAGES, CACHED_IMAGES and TEMPLATE_IMAGES subfolders. Just drop your source images at the top level. The only input is selection_mode (linear or random, default random) - linear walks the folder in listing order, random picks blind.

    How it works. Every run does three passes before handing you anything. First it fixes errors: a processed_ file with no matching product_ file means a previous run died halfway, so it renames that file back to its original name and puts it back in the queue. Second it approves products: a product_ file with no processed_ partner gets moved into APPROVED_IMAGES. Third it picks a file, renames it processed_<name>, and moves it into its own per-file subfolder. Then it reads the PNG's prompt_text metadata (set by the saver on the way out) and returns image, mask, and that text together.

    The IS_CHANGED method returns NaN, the ComfyUI trick that means "never treat me as cached." So every queue genuinely advances the state machine by one image instead of replaying a saved result. If the base folder is empty you get an "All Images Processed" exception - that's the batch being done, not an error you caused.

    Outputs. image goes into any VAE-encode → KSampler path. mask is the source image's alpha channel, inverted (1 where the image is transparent, 0 where opaque), so wire it where you'd wire a mask for compositing or inpaint boundaries. prompt_text feeds a CLIP Text Encode or, more usefully, straight into the saver so your product keeps its caption.

    Pair it with Feidorian_WorkflowImageSaverAdvanced - running the loader without the saver leaves a processed_ file stranded, which just gets untagged and re-queued next run. It's a loop built for the pair.

    Common issues. "Missing Path. Path must be provided to loader node." means the saver executed without the loader in the same graph. "Corrupted directory" exceptions fire if you drop files directly into the per-file subfolders - keep your hands off anything inside WORKFLOW_IMAGES_ADVANCED except the top level. And don't expect updates: the repo is archived, so what you see is what you get.

    Install. ComfyUI Manager (search "feidorian-ComfyNodes"), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Feidorian/feidorian-ComfyNodes
    

    Then restart ComfyUI. No requirements.txt, no model downloads - this pack is pure Python on top of ComfyUI's own PIL/torch, so it's one of the painless installs.

    Categoryfeidorian/workflow-manager

    Inputs (1)

    NameTypeDefaultDescription
    selection_modeCOMBOrandom2 options: linear, random

    Outputs (3)

    NameTypeDescription
    imageIMAGE
    maskMASK
    prompt_textSTRING