Nodes/Model and Prompt from Metadata/Model-Prompt from Metadata
ComfyUI Node

Model-Prompt from Metadata

Model, VAE, and both prompts

By ketle-man·Created 4 months ago·Updated 2 months ago· 0
Model-Prompt from Metadata
    • model
    • clip
    • vae
    • positive
    • negative
    • positive_text
    • negative_text
    • metadata
    • image
    ckpt_name
    vae_name
    positive_text
    negative_text
    _metadata_json
    _image_file

    Here's the flagship of the Model and Prompt from Metadata pack, and the one that makes "reproduce this image" stop being an archaeological dig. Model-Prompt from Metadata (ImageMetadataPromptLoader) reads one image - or a workflow JSON - and pulls out the checkpoint, the VAE, and the positive and negative prompts in one go. It even encodes the prompts for you. Drop the PNG, everything's wired.

    The day I got this working I deleted a genuinely awful habit of keeping a "master" workflow with text files taped to it. This is the "workflow included" culture - ComfyUI embeds the full generation graph in the PNG's prompt chunk - turned into a loader you don't have to think about.

    How it works

    Same front-end engine as its siblings: the browser-side JS parses the metadata (PNG prompt chunk, WebP EXIF, or a pasted JSON workflow), fuzzy-matches the detected checkpoint against your installed files, and shows ✓ / ✗ badges. Where this node goes further is the prompts. If exactly one prompt is detected, it's auto-selected; if the workflow used several, you click the one you want and the full text appears below for a sanity check. Everything flows into the node's inputs, and on the Python side the text is encoded with the loaded model's own CLIP - clip.tokenize + encode_from_tokens under the hood. That's the detail that makes it a faithful reproduction rather than an approximation: the conditioning matches what the model actually saw.

    Inputs and outputs that matter

    The only inputs you'd normally touch:

    • ckpt_name and vae_name - auto-selected when exactly one match is found; None VAE means use the checkpoint's built-in one.
    • positive_text / negative_text - multiline fields that fill themselves when you click a detected prompt. Editable after the fact, which is the whole point.

    The _metadata_json and _image_file fields are internal plumbing. Now the good part - the outputs:

    • model, clip, vae - straight to your sampler.
    • positive / negative - CONDITIONING, already encoded. This node replaces both your checkpoint loader and your two CLIPTextEncode nodes.
    • positive_text / negative_text - the raw strings, so you can feed them into a text-editing node (the pack's CLIP Text Encode edit+ is built for exactly this).
    • metadata and image - the parsed JSON and the dropped image as an IMAGE tensor, for reference workflows.

    A full txt2img workflow is basically: this node → KSampler → VAE Decode. Three nodes, done.

    Installing it

    Shared with the rest of the pack: ComfyUI Manager (search "Model and Prompt from Metadata") or

    cd ComfyUI/custom_nodes
    git clone https://github.com/ketle-man/model-and-prompt-from-metadata
    

    then restart. The pack declares zero Python dependencies - it only uses what ComfyUI already bundles - and needs no model downloads. Lightest install in the ecosystem, honestly.

    Gotchas

    The README is upfront that UNet-based models (Flux, Qwen, Z-Image) are out of scope - the node will show you the detected names but can't load them; that's what the author's Workflow Studio pack is for. Second, an auto-select only happens when there's exactly one detected prompt; multi-prompt workflows need one click. And the classic trap: if the checkpoint that made your image isn't installed, it shows ✗ and nothing auto-selects - you'll pick a stand-in from the dropdown and the prompts will encode against that model's CLIP. For SD1.5/SDXL/Illustrious images you own, this node is a genuine time-saver.

    Categoryloaders

    Inputs (6)

    NameTypeDefaultDescription
    ckpt_nameCOMBOCheckpoint model to load. Drop a ComfyUI PNG/JSON above to auto-select.
    vae_nameCOMBOVAE to use. Select 'None' to use the VAE embedded in the checkpoint.
    positive_textSTRINGPositive prompt text. Set automatically when you click a detected prompt above.
    negative_textSTRINGNegative prompt text. Set automatically when you click a detected prompt above.
    _metadata_jsonSTRING
    _image_fileSTRING

    Outputs (9)

    NameTypeDescription
    modelMODEL
    clipCLIP
    vaeVAE
    positiveCONDITIONING
    negativeCONDITIONING
    positive_textSTRING
    negative_textSTRING
    metadataMETADATA
    imageIMAGE