Nodes/ComfyUI-Leputen-Utils/Load DDS Images (Batch)
ComfyUI Node

Load DDS Images (Batch)

Load every DDS in a folder, in batches, without melting your VRAM

By lilquail·Created 9 months ago·Updated 9 months ago· 1
Load DDS Images (Batch)
    • image
    • mask
    • filename
    • path
    • format
    • color_space
    directorypath/to/folder
    pattern*
    include_subfoldersfalse
    batch_index0
    batch_size-1
    alpha_bleedtrue
    blur_radius0.0
    invert_maskfalse

    Load DDS Images (Batch) is the node that turns a texture pipeline from "open each file by hand" into "point ComfyUI at a folder and walk away." It's the batch sibling of the single Load DDS Image node: it scans a directory, filters by filename pattern, and hands you the DDS files as image lists - with the format and color_space combo outputs that make round-tripping into the DDS Saver painless.

    If you're re-compressing a folder of game textures, or running a normalization pass across an entire material library, this is the loader you want.

    How it works

    On the first run it does a full directory scan (the pack caches the results, so subsequent runs on the same folder are instant - auto-invalidated when the contents change). Files are then decoded with the bundled DirectXTex tooling, same as the single loader.

    The two knobs that define the batch behavior:

    • batch_size - set to -1 to load all files at once (the default). A positive value loads that many files per pass so you can process a 13,000-file library a chunk at a time.
    • batch_index - which batch you're on. The tooltip says it plainly: connect an external iterator for automatic incrementing, or step it manually.

    pattern is glob syntax, and it's worth learning because it's the whole point. *_a.dds grabs only albedo files; *_a.dds;*_n.dds grabs albedo and normals; ? matches a single character. Separate multiple patterns with semicolons.

    Inputs and outputs

    Required inputs: directory (absolute path), pattern (default *), include_subfolders, batch_index, batch_size, alpha_bleed. Optional: blur_radius (0–10, for smoother alpha bleeding) and invert_mask.

    Outputs are all lists:

    • image and mask - the pixels, ready for processing.
    • filename and path - the source names/paths, so you can preserve naming on save.
    • format and color_space - per-file combos that wire straight into Save DDS Image's format and output_color_space. This is the feature that makes "convert a folder, keep every file's format" a two-node graph.

    Install

    Standard for this pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/lilquail/ComfyUI-Leputen-Utils
    

    Restart, then look under Leputen-Utils → DDS. It's Windows-first: the DDS decoding relies on the bundled texconv.dll, and on macOS/Linux you'll need to grab the matching libtexconv.* from Texconv-Custom-DLL releases and drop it in bin/.

    Troubleshooting

    • Patterns are case-sensitive on Linux/macOS but case-insensitive on Windows. A *_A.DDS filter behaves differently across platforms - keep patterns lowercase to avoid surprises.
    • BC5 files crash the loader. The pack's known-issues list says BC5-compressed images can be saved but not loaded, and attempting it errors out and needs a ComfyUI restart. Filter *_n.dds carefully if your normal maps are BC5.
    • Slow first scan? Normal. The README clocks a 13,000-file scan at ~2s once, then instant cache hits.
    • Memory - with batch_size=-1 a big library loads all at once. If you're processing thousands of 2K textures, that's the moment to use a real batch size and an iterator.

    The cache is the quiet hero here. Iterate over a folder, tweak a setting, re-run - the rescan is free, which is exactly what makes experimenting on 500 files tolerable.

    CategoryLeputen-Utils/DDS

    Inputs (8)

    NameTypeDefaultDescription
    directorySTRINGpath/to/folderThe absolute path to the directory containing files to load.
    patternSTRING*Filename filter pattern using glob syntax. Examples: • * = all files • *_a.dds = files ending in _a.dds • texture_* = files starting with texture_ Multiple patterns: Use semicolon (;) to match multiple patterns: • *_a.dds;*_n.dds = albedo and normal maps
    include_subfoldersBOOLEANfalseIf enabled, recursively scans subdirectories for matching files.
    batch_indexINT0Current batch index. Connect an external iterator for automatic incrementing.
    batch_sizeINT-1Number of files to load per batch. Set to -1 to load ALL files at once.
    alpha_bleedBOOLEANtrueEnable alpha bleeding to prevent halo artifacts around transparent areas.
    blur_radiusoptFLOAT0.00–10Apply blur during alpha bleeding for smoother transitions.
    invert_maskoptBOOLEANfalseInvert the output mask (white becomes black and vice-versa).

    Outputs (6)

    NameTypeDescription
    imageIMAGE
    maskMASK
    filenameSTRING
    pathSTRING
    formatBC1_UNORM,BC2_UNORM,BC3_UNORM,BC4_UNORM,BC5_UNORM,BC6H_UF16,BC6H_SF16,BC7_UNORM,R16G16B16A16_FLOAT,R32G32B32A32_FLOAT,R8G8B8A8_UNORM,B8G8R8A8_UNORM,B8G8R8X8_UNORM,R10G10B10A2_UNORM
    color_spacesRGB,Linear