Nodes/ComfyUI-hybs-nodes/Load Image Prompt Metadata
ComfyUI Node

Load Image Prompt Metadata

Load an image and its prompt in the same node

By hybskgks28275·Created about a year ago·Updated 2 months ago· 3
Load Image Prompt Metadata
    • IMAGE
    • positive
    • negative
    image
    positive_node_id
    negative_node_id

    "Workflow included" is the community norm for a reason: every ComfyUI-generated PNG carries the whole pipeline as embedded metadata, and dragging the image back into ComfyUI rebuilds the graph. HYBS_LoadImagePromptMetadata rides that same mechanism in the other direction - it loads an image and pulls the positive and negative prompts out of its embedded metadata, so you can reuse them in a new workflow without retyping.

    The obvious use is img2img/i2i: someone posts a great image, you drop it in, and instead of eyeballing a screenshot to transcribe the prompt you get it as a clean text output you can wire straight into a CLIP Text Encode node. The less obvious use is your own archive - when you re-edit an old generation, the exact prompt comes along for the ride.

    How it works

    image is a combo dropdown of files in ComfyUI's input folder, just like Load Image. The node reads the PNG's metadata, looks for the standard workflow and prompt keys (plus a few variants), parses the JSON, and walks the node list looking for the node IDs you name. When it finds a match it takes the first string it can find among that node's widget values - which for a CLIP Text Encode node is your prompt text.

    Two string inputs tell it what to find:

    • positive_node_id - node ID to read as the positive prompt
    • negative_node_id - node ID to read as the negative prompt

    Both support subgraph IDs like 82:78 (parent:child), which matters for workflows that use subgraphs. Outputs are IMAGE (the loaded image, so you don't need a separate Load Image), plus positive and negative strings.

    Getting the node IDs

    Here's the part that confuses people. You need the node IDs from the source workflow's metadata, not from your current graph. The fastest way: open the source image in ComfyUI (drag it onto the canvas or into the window), let the workflow reconstruct, then look at the IDs on the CLIP Text Encode nodes - they're the big numbers in the node title bar. Type those into this node's inputs. The author ships an example in the repo (workflow/LoadImagePromptMetadata.json + a sample PNG) if you want to see the pattern.

    If the source image has no metadata, or the ID you gave doesn't resolve to prompt text, the node raises an error rather than silently returning garbage - so a blank result usually means "that ID isn't a text node" or "this image came from A1111/Forge", which use a different metadata format this node isn't built to parse.

    Installation

    Standard pack install - no model downloads:

    cd path/to/ComfyUI/custom_nodes
    git clone https://github.com/hybskgks28275/ComfyUI-hybs-nodes.git
    pip install -r ComfyUI-hybs-nodes/requirements.txt
    

    Or "ComfyUI-hybs-nodes" in ComfyUI Manager, then restart. The only pip dependency is toml, which this node doesn't touch.

    One honest caveat: if you only need the prompt, ComfyUI already lets you drag an image in and copy the prompt from the workflow tab. This node earns its place when you're automating - wiring the recovered prompt straight into an encode node, or rebuilding a pipeline where the prompt must live as graph data. That's a real niche, and if you're in it, this is a tidy little node.

    CategoryHYBS/LoadImage

    Inputs (3)

    NameTypeDefaultDescription
    imageCOMBOImage from ComfyUI's input folder that contains workflow or prompt metadata.
    positive_node_idSTRINGNode ID to read as the positive prompt. Subgraph IDs such as 82:78 are supported.
    negative_node_idSTRINGNode ID to read as the negative prompt. Subgraph IDs such as 82:78 are supported.

    Outputs (3)

    NameTypeDescription
    IMAGEIMAGELoaded image.
    positiveSTRINGPrompt text read from positive_node_id.
    negativeSTRINGPrompt text read from negative_node_id.