Nodes/ComfyUI_Dynamic_TagLoader/🔍 Workflow Metadata Reader
ComfyUI Node

🔍 Workflow Metadata Reader

Drag in any ComfyUI image and pull out the prompt that made it

By NineKey1028·Created 8 months ago·Updated 5 days ago· 4
🔍 Workflow Metadata Reader
    • workflow_json
    • clean_text
    • selected_path
    • image
    image_or_dirC:/ComfyUI/output
    search_byID
    search_query00
    seed0

    ComfyUI's sharing culture runs on a neat trick: every output PNG carries its entire workflow - node by node, widget by widget - embedded in the file's metadata. 🔍 Workflow Metadata Reader is a small node that exploits exactly that. Give it an image, and it extracts the workflow JSON, finds the node you care about, and hands back that node's prompt text plus the image itself. It's the "reverse-engineer any workflow from a single image" button, and it's the most ambitious node in the pack.

    How it works

    You point it at a file or a folder via image_or_dir:

    • Single image - a path that exists, or a filename ComfyUI can resolve against its input and output folders. Drag an image onto the node (or Ctrl+V from the clipboard) and the pack's front-end copies it into the input folder for you, so you can work with it by name.
    • Folder - it lists all .png/.webp/.jpg/.jpeg files inside, sorts them, and picks one by seed % count. That's the automation angle: batch-scan a folder of outputs and let the seed walk through them.

    Once it has a file, the node opens it with PIL and reads the workflow chunk out of the PNG metadata. That chunk is JSON, so it parses the node list and matches against your search_by choice:

    • ID - matches node.id == search_query, then collects that node's widgets_values into text. Great when you know the node's ID in the workflow.
    • Type - matches node.type == search_query, e.g. CLIPTextEncode. This is the one most beginners want: filter by node type and get every matching node's prompt text, newline-joined, in one go.

    Outputs are the useful spread: workflow_json (the full raw JSON - inspect it to find node IDs), clean_text (the matched widget values as text), selected_path (which file it actually read), and image (the image itself as a tensor, EXIF-corrected, ready to feed a sampler or preview).

    The author's own warning - read this first

    The README is blunt: for this to work, the prompt has to actually be in the metadata, written before the image was produced, and the workflow has to use something like a Show Text node to surface the prompt. Get the execution order wrong and you'll read stale or empty values - that's precisely the case where the pack wants you to add ⏳ Wait For to force the prompt node to run first. And if the image wasn't generated in ComfyUI (or was re-saved without metadata), there's no workflow chunk at all; you'll get a "No nodes match" message and an empty clean_text. That's not a bug, it's the format being absent. The workflow_json output is your debugging friend: if a search comes up empty, look at the JSON to see what node IDs and types actually exist before guessing.

    Install

    It's the fourth node in ComfyUI_Dynamic_TagLoader, so the standard one-liner applies:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/NineKey1028/ComfyUI_Dynamic_TagLoader.git
    

    Restart ComfyUI. The pack needs nothing beyond what ComfyUI already ships - no pip installs, no model files, and that's true of this node in particular since all the heavy lifting is PIL reading PNG metadata.

    One caveat worth repeating: this is a small, single-maintainer pack with a thin community footprint. The node is genuinely handy for mining prompts out of shared images, but its niche status means the README and the bundled example workflows are your real documentation - don't expect a pile of forum threads to bail you out.

    CategoryDynamicTags

    Inputs (4)

    NameTypeDefaultDescription
    image_or_dirSTRINGC:/ComfyUI/output
    search_byCOMBOID2 options: ID, Type
    search_querySTRING00
    seedINT00–18446744073709550000

    Outputs (4)

    NameTypeDescription
    workflow_jsonJSON
    clean_textSTRING
    selected_pathSTRING
    imageIMAGE