Nodes/quadmoon's ComfyUI nodes/Get A1111 Prompt from Image
ComfyUI Node

Get A1111 Prompt from Image

Pull an A1111 Prompt Out of a PNG and Rebuild It in ComfyUI

By traugdor·Created 3 years ago·Updated 9 months ago· 16
Get A1111 Prompt from Image
    • POSITIVE
    • NEGATIVE
    • HI-RES_PROMPT
    • SEED
    • STEPS
    • CFG
    • HEIGHT
    • WIDTH
    • CLIP_SKIP
    image

    Automatic1111 has been writing the full generation settings into its PNGs since forever - prompt, negative, seed, steps, CFG, size, clip skip - all stuffed into a text chunk of the file. This node reads that chunk back out and splits it into separate outputs, so you can reconstruct an A1111 image's settings inside ComfyUI without squinting at a PNG-info panel and retyping them.

    Why you'd reach for it

    You have a folder of old A1111 images and you want to reproduce them - or riff on them - in ComfyUI. One of the reasons ComfyUI became the standard is that it embeds its entire workflow in the PNG metadata, which makes sharing trivial (see the ecosystem essay in the KB). A1111 never did that; it only stored the parameters. So for A1111 files, this node is your bridge: it parses the parameters text and hands you the pieces on separate wires. The README says it plainly: "This node is not needed with images generated by ComfyUI" - those carry the workflow graph itself and you just drag the file onto the canvas.

    How it works

    It opens the PNG, reads the parameters metadata field, and regex-parses it. It pulls the prompt (everything before "Negative prompt:"), the negative (between "Negative prompt:" and "Steps:"), the hi-res prompt if present, plus seed, steps, CFG scale, and size. One detail worth knowing: the CLIP_SKIP output is negated - A1111 writes clip skip 2, and ComfyUI counts negative (-2), so this node converts it for you. That's a genuinely thoughtful touch.

    Inputs and outputs

    • image - an image from your input folder (it shows up as a normal image-picker widget).

    Nine outputs: POSITIVE, NEGATIVE, HI-RES_PROMPT, SEED, STEPS, CFG, HEIGHT, WIDTH, CLIP_SKIP.

    The wiring you'll actually do: POSITIVE and NEGATIVE into a CLIP text encoder, SEED into the sampler's seed, STEPS/CFG into the sampler, HEIGHT/WIDTH into an empty latent or image scale, and CLIP_SKIP into a clip-set-last-layer node if you're staying faithful to the original.

    Installing it

    Part of "quadmoon's ComfyUI nodes". ComfyUI Manager: search the pack title or Install via GIT URL with https://github.com/traugdor/ComfyUI-quadMoons-nodes.git. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/traugdor/ComfyUI-quadMoons-nodes.git
    

    Restart ComfyUI. No models or dependencies.

    Common issues

    Metadata is the whole ballgame, and metadata is exactly what gets stripped. If an image has been re-saved, re-uploaded, or passed through a site that cleans PNG chunks, the parameters field is gone and the node's regex finds nothing - you'll get default-ish values back, and a missing negative prompt comes back empty. Hi-res is worth a mention too: HI-RES_PROMPT only fills in when the original run used a hires pass and A1111 wrote the field, which it doesn't always. So treat the outputs as "best effort from the metadata," not a promise about what the image was actually made with.

    CategoryQuadmoonNodes/Converters

    Inputs (1)

    NameTypeDefaultDescription
    imageCOMBO1 options: example.png

    Outputs (9)

    NameTypeDescription
    POSITIVESTRING
    NEGATIVESTRING
    HI-RES_PROMPTSTRING
    SEEDINT
    STEPSINT
    CFGFLOAT
    HEIGHTINT
    WIDTHINT
    CLIP_SKIPINT