Nodes/ComfyUI illumorae/Load Image Random Variant
ComfyUI Node

Load Image Random Variant

Load a random camera-angle variant, not a random image

By CorvaeOboro·Created 8 months ago·Updated 5 days ago· 1
Load Image Random Variant
    • image
    • mask
    • file name
    • folder path
    folderC:/input
    base_filenameimage
    extension.png
    variant_suffixes_CAM_ORTHO_PROJ_
    search_variantstrue
    seed-1
    variant_index_override-1
    debug_modefalse

    "Load a random image from a folder" is a solved problem. Load Image Random Variant is for a much more specific workflow: you have a base asset - say potionA.png - and a folder of variants of that asset in a subfolder, like potionA/potionA_CAM_ORTHO_PROJ_1.png, potionA_CAM_ORTHO_PROJ_2.png, and so on. It loads the base image and then picks a random one of its variants. This is asset-pipeline vocabulary: product shots, character renders, camera angles, texture variants - all sharing one base name with a suffix pattern.

    If you've ever built a ComfyUI loop that regenerates an asset and wanted it to sample the available views rather than always grabbing the same file, this node is the missing piece. It's also handy for dataset generation where you want variety in a controlled, per-asset way rather than chaos across a whole folder.

    How it works

    Give it a folder, a base_filename (no extension), and an extension (default .png). It loads folder/base_filename.png as the fallback, then - if search_variants is on (default) - looks in a subfolder named after the base image for files matching the variant_suffixes pattern. The default suffix, _CAM_ORTHO_PROJ_, tells you this was written for a specific render pipeline, but any suffix string works; the variant files just need the suffix somewhere in their name and a trailing index. The README's example structure is the template:

    D:\items\potionA.png
    D:\items\potionA\potionA_CAM_ORTHO_PROJ_1.png
    D:\items\potionA\potionA_CAM_ORTHO_PROJ_2.png
    

    Then the selection controls:

    • seed - default -1 means truly random (a new pick every run). Set a positive seed for reproducibility - important when you want a specific variant's result back.
    • variant_index_override - default -1 (random); set it to a specific index to force one variant instead of rolling the dice. Great for debugging or for a deliberate pick.
    • debug_mode - prints what it found and what it chose.

    Outputs: image, mask (the alpha channel, standard for loaded images), file name (STRING), and folder path (STRING) - so downstream nodes know exactly which variant got loaded and where it lives.

    If no variants are found, it just loads the base image and moves on. No crash, no fuss.

    Installing it

    Part of CorvaeOboro's ComfyUI_illumorae (CC0, pure code). ComfyUI Manager → search illumorae, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/CorvaeOboro/ComfyUI_illumorae
    

    Common issues

    • Always loads the base image, never a variant - the variant subfolder/suffix convention doesn't match your files. Either rename to match (subfolder named after the base, suffix in the filename) or check variant_suffixes - if your files use _FRONT_ instead of _CAM_ORTHO_PROJ_, change the suffix string.
    • You can't reproduce a result - seed is -1 (random). Set a seed to lock the pick; set variant_index_override for a guaranteed specific variant.
    • It's random per run - remember ComfyUI caches: with seed -1 the node needs to be considered changed to re-roll. If you're rerunning and getting the same variant, that's the cache; changing the seed to a fresh value (or ensuring the random path fires) is the fix.
    Categoryillumorae

    Inputs (8)

    NameTypeDefaultDescription
    folderSTRINGC:/input
    base_filenameSTRINGimage
    extensionSTRING.png
    variant_suffixesSTRING_CAM_ORTHO_PROJ_
    search_variantsBOOLEANtrue
    seedINT-1
    variant_index_overrideINT-1
    debug_modeBOOLEANfalse

    Outputs (4)

    NameTypeDescription
    imageIMAGE
    maskMASK
    file nameSTRING
    folder pathSTRING