ComfyUI Node

VFileRandom

VFileRandom - load a random image from a folder without repeats. Draws like a shuffled deck: every image in the folder is shown exactly once before any image repeats. The cycle is remembered per folder in a state file, so it survives ComfyUI restarts. Images added to the folder mid-cycle join the current cycle; deleted ones are dropped. Outputs the image, its alpha mask, the filename (relative to the folder, also as a variant without the file extension) and how many images are left before the deck reshuffles.

By vangel76·Created 19 days ago·Updated 3 days ago· 0
VFileRandom
    • image
    • mask
    • filename
    • remaining_in_cycle
    • filename_noext
    folder
    seed0
    include_subfoldersfalse
    reset_cyclefalse
    CategoryValiTools

    Inputs (4)

    NameTypeDefaultDescription
    folderSTRINGAbsolute path to the folder to draw images from.
    seedINT00–18446744073709550000Only triggers a new draw (keep it on 'randomize'); the no-repeat cycle itself is stateful.
    include_subfoldersBOOLEANfalse
    reset_cycleBOOLEANfalseForget which images were already drawn and start a fresh shuffled cycle on this run.

    Outputs (5)

    NameTypeDescription
    imageIMAGE
    maskMASK
    filenameSTRING
    remaining_in_cycleINT
    filename_noextSTRING