Get String from Image
Get the exact prompt text out of a generated image
- image
- STRING
When someone shares an image with "workflow included," the thing you actually want isn't usually their graph - it's the prompt. Get String from Image pulls any text value out of the metadata ComfyUI bakes into a PNG, and the prompt is the obvious first target.
This is one of the eight nodes in shinich39's comfyui-get-meta pack, and it's the most flexible of the "query" family: the same node that recovers a positive prompt also grabs a checkpoint filename, a scheduler name, or the contents of a Note node. One tool, any string.
How it works
The pattern is shared across the whole pack, so it's worth internalizing once. The Python class is a passthrough - it just returns the value sitting in its string widget. The real logic is in the browser: the extension traces the image loader feeding the image input, calls a local backend route that opens the file with Pillow and returns the embedded metadata, parses the stored prompt JSON (JSON5), finds the node and widget your query names, and writes the value into the widget. Because the author hardcodes IS_CHANGED to always-true, the node re-executes every run and the recovered text actually flows through your graph.
Two important details about where the text comes from. The values come from the prompt metadata - the API graph that actually executed - so you get the real prompt that ran, not a stale copy in the UI. And it handles ComfyUI's own PNG text chunks plus WebP EXIF (the A1111/Forge format), which is a nice compatibility touch.
The inputs and output that matter
- image - wire from a supported loader: core
LoadImage/LoadImageMask, Inspire Pack's "LoadImage //Inspire", Crystools' "Load image with metadata [Crystools]", or WAS Node Suite's "Image Load". - query - the text you want. The format is
NODE_TYPE.WIDGET_NAME, with#NODE_ID.WIDGET_NAMEfor IDs. Your go-to examples:CLIPTextEncode.text- the positive prompt (add[0], a title, or a#ID if there are multiple encoders)Load Checkpoint.ckpt_name- which checkpoint made the imageNote.text- Note nodes are a special case, and their contents are pulled from the workflow metadata
- string - the multiline result widget, default empty. Runs overwrite it.
The single STRING output wires into any text input - re-feed it into a CLIPTextEncode, show it with a text display node, or feed it into a prompt-enhancing tool.
Installing it
ComfyUI Manager → search comfyui-get-meta → Install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/shinich39/comfyui-get-meta
Restart after cloning. No models, no extra Python deps - Pillow is already there and JSON5 ships bundled. This is one of the lightest installs in the custom-node world.
Common issues
- Empty result - the image carries no embedded metadata (metadata-stripped save, web re-upload, screenshot). Nothing to extract.
- Query doesn't match - names are exact and case-sensitive.
KSampler.positivewill fail; the prompt lives on the CLIP text encoder, not the sampler. UseGet Values from Imagefrom the same pack to list every valid#NODE_ID.WIDGETkey, then copy the one you need. - Unsupported loader - video frames, URL fetchers, and folder-batch loaders aren't traced, so no file path means no fill.
Honest take: if you're regularly recycling other people's prompts, this is the node that saves you from screenshotting their text. Just remember the metadata has to exist for it to be worth anything.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| query | STRING | — | |
| string | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |