Nodes/ComfyUI-Prompting-System/πŸ“– Metadata Reader
ComfyUI Node

πŸ“– Metadata Reader

Pull the prompt back out of any PNG

By danieljanataΒ·Created 8 months agoΒ·Updated 8 months agoΒ· 0
πŸ“– Metadata Reader
    • prompts
    β—„imageβ–Ύβ–Ί

    You know that image you saved from a thread last month - the one with the exact look you've been failing to recreate all week? The prompt that made it is probably still in the file. πŸ“– Metadata Reader is a tiny node that opens a PNG from your input folder and hands back every prompt string it can find inside. It's the "how was this actually made" answer for the 90% of the time the answer was baked into the image all along.

    Why you'd reach for it

    The "workflow included" culture is one of the nicest things about the ComfyUI ecosystem: the app writes your whole graph into the PNG it saves, so dragging an image back in reconstructs everything. But that works in reverse too. Grab any generated PNG, read its text chunks, and you've got the recipe. That's exactly what this node automates - no hex editor, no Python script, no third-party exif tool.

    How it works

    It doesn't use PIL or any image library at all. It opens the PNG file and walks the chunk stream directly, decoding the tEXt and zTXt (compressed) text chunks with nothing but Python's struct and zlib. Then it picks through the three places prompts actually hide:

    • the workflow chunk - ComfyUI's graph JSON, where it grabs widget text values longer than 20 characters,
    • the prompt chunk - the serialized graph's text, prompt, positive, and negative inputs,
    • the parameters chunk - the classic A1111-style line with the prompt and settings.

    Everything it finds is deduped and joined into one string separated by ---, which comes out of the single prompts output.

    What you set

    There's exactly one input: image, a dropdown listing every PNG/JPG/WebP in your ComfyUI input folder, with an upload widget so you can drop in a file without touching the filesystem. That makes this about as beginner-friendly as a node gets. Wire the prompts output into a Show Text node to actually read what it found, or into any text input if you want to reuse a recovered prompt.

    Gotchas

    It's PNG-only. Feed it a JPG and the output string is literally Not a PNG file. And when there's nothing to find, the output is the string No prompts found in metadata rather than an empty value - fine when you're eyeballing results, but know it's there before you pipe this blindly into another node. One nice touch: the node re-reads the file from disk on every execution, so it always reflects what's actually on disk, which is exactly what you want from a reader.

    Installing

    This node is part of the ComfyUI-Prompting-System pack, so installing the pack gets you all four of its nodes plus a "PS" sidebar tab. ComfyUI Manager is the easy route - search "ComfyUI-Prompting-System" in the Custom Nodes Manager. Or do it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/danieljanata/ComfyUI-Prompting-System
    

    Then restart ComfyUI. There's no requirements.txt and no model to download - the pack only touches things ComfyUI already ships (Pillow, aiohttp, numpy), so this one installs clean. Fair warning: the repo ships no README and the pack is brand new, so treat the code as the documentation and don't expect a roadmap.

    CategoryPrompting-System

    Inputs (1)

    NameTypeDefaultDescription
    imageCOMBO2 options: , example.png

    Outputs (1)

    NameTypeDescription
    promptsSTRINGβ€”