Nodes/ClipVision_Tools/Edit Results
ComfyUI Node

Edit Results

Fix, filter, and re-point your image search results by filename

By MoonMoon82·Created 11 months ago·Updated 10 months ago· 10
Edit Results
  • results
  • results
methodexclude
edit_textremove*images.jpg
replace_text/newpath/

Edit Results is the pack's utility belt for whatever you want to do to a search result set before you browse it. It edits the filenames in a SRESULTS output using simple wildcard patterns, and it does three genuinely different jobs depending on the method you pick.

This is the node you reach for when your search returns 800 "similar" images and you only care about the ones from one shoot, or when you moved your image folder and every Result Browser is throwing file-not-found. It sits between Image Searcher and the browser nodes: ImageSearcher → EditResults → ResultBrowser.

The three methods

The node matches against the stored filenames (which include the folder path relative to your database's base folder), using * wildcards in the Python fnmatch style.

  • exclude (default) - drop everything that matches edit_text. The default remove*images.jpg gives you the idea: kill the thumbnails and junk before browsing.
  • filter - the inverse. Keep only the filenames that match. If you want search results restricted to one folder, *vacation* is a one-line filter.
  • replace - rewrite the matched part of the filename with replace_text. This is the path-repair tool: moved your image collection and now every result 404s? Match the old path prefix and replace it with the new one.

Only three inputs do the work: method, edit_text, and replace_text (which is ignored unless method is "replace"). Output is a new results set you can chain through another EditResults or straight into a browser. A nice pairing: FolderScores emits a filterstring of folder* patterns - paste that into edit_text with method "filter" to keep only your top-ranked folders.

Why the replace method exists

It's worth calling out, because it's the node that rescues you after the classic self-inflicted wound. Databases store relative paths, and LoadDB re-joins them to whatever base path you type in. Move the actual image files and the whole DB points at nothing. Two ways out: regenerate the DB, or run EditResults with method "replace" and re-point the path without re-encoding a single image. For a 100,000-image collection, that's the difference between a two-second edit and re-encoding everything.

Installing it

Standard pack install - ComfyUI Manager, search "ClipVision_Tools", install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/MoonMoon82/ClipVision_Tools
cd ClipVision_Tools
python -m pip install -r requirements.txt

Only orjson and pillow-heif needed, same as the rest of the pack.

Gotchas

  • Wildcards only; this isn't regex. * matches any run of characters, ? matches a single one.
  • Exclude and filter operate on the path as stored, so know whether your DB paths are folder/file.jpg or file.jpg.
  • Replace rewrites the display path, but if you later re-load results from the original DB you're back to square one - the edit is per-result-set, not written back to the database. (EditDB is the version that edits the DB itself.)
CategoryClipVisionTools

Inputs (4)

NameTypeDefaultDescription
resultsSRESULTS
methodCOMBOexcludeMethod to edit results
edit_textSTRINGremove*images.jpgUse wildcards (*) to match filenames or paths
replace_textSTRING/newpath/Text to replace with (only for 'replace' method)

Outputs (1)

NameTypeDescription
resultsSRESULTS