Nodes/ComfyUI-Simple_Readable_Metadata-SG/Simple_Readable_Metadata_Save_Prompt (POSITIVE)-SG
ComfyUI Node

Simple_Readable_Metadata_Save_Prompt (POSITIVE)-SG

The fix for prompts that save as (empty) in your metadata

By ShammiG·Created 10 months ago·Updated 6 months ago· 63
Simple_Readable_Metadata_Save_Prompt (POSITIVE)-SG
    • connect_to_CLIP_text_encode
    text

    Here's a ComfyUI quirk that's tripped up more people than it should: if you connect anything to a CLIP Text Encode node's text box - a prompt-builder, a LoRA stack, a random text node - the literal prompt never makes it into the embedded workflow. The metadata saves a node reference instead, so later, when you or someone else reads that image's metadata, the positive prompt shows up as (empty). The image is fine; the recipe is missing the main ingredient.

    SavePositivePromptSG exists to fix that for future workflows. It sits right before your positive CLIP Text Encode node. You feed it your final prompt text, it passes the exact same string through to the CLIP node so nothing changes about your generation, and it also writes that literal text into the workflow JSON and into the extra_pnginfo that gets embedded in the saved image. Result: the saved image's metadata contains your real positive prompt, readable by the pack's metadata nodes (or anyone who reads the PNG info).

    How it actually works

    The mechanism is clever and a little sneaky. It's a passthrough node - one input, one output - that runs during execution and uses ComfyUI's hidden prompt and extra_pnginfo arguments to reach into the workflow graph. It overwrites its own entry in the prompt dict's inputs.text with the actual string, forces its title to "Positive Prompt (Saved)" so it's identifiable in a workflow dump, and adds the text to extra_pnginfo under a PositivePrompt_<node-id> key. When the SaveImage node writes the file, that extra info goes into the PNG chunks. That's the whole trick.

    The input and output

    • text (STRING) - the author's own tooltip says it all: "FINAL TEXT to be connected to CLIP Text Encode Positive node's box." This is where your prompt-builder chain ends.
    • connect_to_CLIP_text_encode (STRING) - wire this into your positive CLIP Text Encode node's text input. Nothing clever needed; the string just flows through.

    That's it. No settings, no toggles.

    Installing

    It ships in the Simple Readable Metadata pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ShammiG/ComfyUI-Simple_Readable_Metadata-SG.git
    cd ComfyUI-Simple_Readable_Metadata-SG
    pip install -r requirements.txt
    

    Or Manager → Custom Nodes Manager → search Simple Readable Metadata-SG → install → restart. No models to download.

    The honest limitations

    • It only helps new images. This injects the prompt at save time, so it does nothing for images already on disk. For those, use the pack's Text Viewer's "show all text in workflow" feature to dig the prompt out of the embedded workflow.
    • It fixes the (empty) display, not a stripped file. If an image host re-encodes the PNG and drops the chunks, the prompt is gone for good.
    • The README's "verify the final copied text" advice applies here too: the node guarantees the text you gave it is stored, but if you're copying it back out later, give it a quick glance.
    • And the pack-wide reminder: on ComfyUI 0.3.76+, switch Node 2.0 OFF or the display nodes misbehave.

    There's a mirror node, SaveNegativePromptSG, for the negative box - same design, opposite sign. If your negatives also vanish into (empty), you want both.

    Categoryutils/metadata

    Inputs (1)

    NameTypeDefaultDescription
    textSTRINGFINAL TEXT to be connected to CLIP Text Encode Positive node's box

    Outputs (1)

    NameTypeDescription
    connect_to_CLIP_text_encodeSTRINGConnect this to your POSITIVE CLIP Text Encode node input.