ComfyUI Node

Asset Filter

Tell ComfyUI Only the New References Matter

By Zar4X·Created about a year ago·Updated 4 days ago· 16
Asset Filter
    • images
    • videos
    • image_count
    • video_count
    freshness_hours24.0

    Let's be honest about this one up front: AssetFilter is the fiddliest node in the ComfyUI-Batch-Process pack, and you'll know if you need it. It exists for a specific, slightly awkward problem - reference-heavy workflows where you've got a row of reference images or videos connected, you swap one of them, and the whole graph behaves as if every connected slot is fresh and worth reacting to. AssetFilter's job is to say: only the things that actually changed should flow through.

    The author's own description is "Drops stale asset slots left over from previous runs." If you've never hit that problem, this node is nothing to you. If you have - if you keep a fixed set of refs connected and only ever change one, and the downstream node keeps re-running as if all of them were new - this is the fix, and there isn't much else like it.

    How it works

    The node is an output plumbing node with a growing input list. Connect something to the last free image slot and a new one appears; same for video slots. That list is managed by a small JavaScript addon that ships with the pack (web/asset_filter.js), so this node needs the full install, not just the Python.

    For each connected slot, AssetFilter traces up the graph to find the actual source file behind it - the filename sitting in your LoadImage, say - and treats that filename as the slot's identity. On the next run, any slot whose source filename hasn't changed is "stale" and gets dropped from the output; the slots you actually swapped pass through. Images generated during the run have no source file and always pass through. If every connected asset looks stale, it gives up and passes everything, so you never get a silent empty output - that fallback is deliberate.

    It keeps state per workflow-plus-node in a small JSON file (zar4x_asset_filter_state.json) in your ComfyUI user directory. Which brings us to the one input you actually set:

    • freshness_hours (default 24, range 0.1–720) - and here's the honest gotcha: it only matters on the very first run, when there's no saved state yet. On that bootstrap run, a slot's source file is kept if its mtime on disk is newer than the window; otherwise it's treated as stale. After that, change-detection takes over and the slider mostly sits there looking important.

    The outputs: images and videos (whatever came through the filter), plus image_count and video_count - an INT pair you can use as a condition if you're doing something clever with them. All four are what they look like.

    Installing it

    It's part of the ComfyUI-Batch-Process pack, so:

    • ComfyUI Manager: search "ComfyUI-Batch-Process".
    • Manual:
    cd ComfyUI/custom_nodes
    git clone https://github.com/Zar4X/ComfyUI-Batch-Process
    

    Restart after. No extra dependencies beyond the Pillow + torch the pack already lists, and no model downloads.

    Common issues

    • The growing input list doesn't show up. That's the JS not loading - make sure the web/ directory is intact in the install and restart. Old or partial installs will break the dynamic slots.
    • Behavior changes after you rename or duplicate the node. The state is keyed on the workflow ID plus node ID, so a fresh node re-bootstraps by mtime instead of remembering what you had. This is the trap with any stateful node: it's not a pure function, its behavior depends on run history.
    • Runtime-generated images always pass through. No source file on disk means AssetFilter can't fingerprint them, so they're never "stale." That's by design, but it means the node is best upstream of file-backed loads, not after a generator.
    • Everything passing through when you expected drops - that's the all-stale fallback. It's there so you never get silence; if it surprises you, check that your source files actually changed.

    Verdict: niche, stateful, and the only thing in the pack that will make you think about caching. If you live in reference-heavy workflows, worth an afternoon. If not, you can safely skip it.

    CategoryBatch Process

    Inputs (1)

    NameTypeDefaultDescription
    freshness_hoursFLOAT24.00.1–720

    Outputs (4)

    NameTypeDescription
    images*
    videos*
    image_countINT
    video_countINT