Nodes/ComfyUI_Fill-Nodes/FL Image Randomizer
ComfyUI Node

FL Image Randomizer

Seeded, reproducible random picks from a folder of media

By filliptm·Created 3 years ago·Updated about 12 hours ago· 628
FL Image Randomizer
    • image_batch
    • selected_path
    • image_list
    • filename
    modeImage
    directory_path
    seed0
    search_subdirectoriesfalse

    FL_ImageRandomizer grabs one image or video out of a folder based on a seed. The "based on a seed" part is what makes it more than just a random-file picker: it uses a modulo operation against the file count, so the same seed on the same folder always returns the same pick. That's the whole design - deterministic randomness, which is exactly what you want when you're building a batch pipeline you might need to reproduce or debug later, versus a pick that changes every time you so much as re-queue the graph.

    What it does. Point directory_path at a folder, set mode to either Image or Video, and it lists the matching files (recursing into subfolders too if search_subdirectories is on) and picks one deterministically from seed. It's a genuinely common pattern in this kind of workflow: point it at a folder of reference images, source clips, background plates, or textures, and let the seed control which one you get on a given run - reproducible for a fixed seed, effectively random if you let ComfyUI randomize the seed between queues.

    Outputs give you options. image_batch is the picked media as a batch tensor - the normal thing to wire into most downstream nodes. image_list is the same content as a per-item list instead, which matters if you picked a video (a sequence of frames) and the next node in your graph wants to iterate frame-by-frame rather than treat it as one batch. selected_path gives you the full file path that got chosen, and filename just the name - wire either of those into a logging node or a caption saver if you want to track which source file ended up in a given run.

    Installing it is the pack's standard pattern: search "Fill-Nodes" in ComfyUI Manager, or clone it manually -

    cd ComfyUI/custom_nodes
    git clone https://github.com/filliptm/ComfyUI_Fill-Nodes
    
    • then restart ComfyUI. No extra dependencies to worry about; it's directory listing plus standard image/video loading.

    Where people trip up. seed accepts a huge range (up to roughly 1.8×10¹⁹), which is the pack's usual convention - pair it with ComfyUI's control-after-generate set to "randomize" if you want a fresh pick every queue, or leave it fixed to lock in a specific selection for reproducibility. mode is either/or, not mixed - if your target folder has both images and video files sitting together and you set mode to Image, don't expect it to also consider the video files in there, and vice versa. And double-check directory_path resolves correctly from wherever your ComfyUI process is actually running - a relative path that works when you launch ComfyUI from one directory can silently point somewhere unexpected (or nowhere) if you launch it from another, which is a generic gotcha with any node that takes a raw filesystem path rather than using ComfyUI's managed input folder.

    Category🏵️Fill Nodes/Image

    Inputs (4)

    NameTypeDefaultDescription
    modeCOMBOImage2 options: Image, Video
    directory_pathSTRING
    seedINT00–18446744073709550000
    search_subdirectoriesBOOLEANfalse

    Outputs (4)

    NameTypeDescription
    image_batchIMAGE
    selected_pathPATH
    image_listIMAGE
    filenameSTRING