获取图片信息
Read a PNG's embedded workflow from inside your graph
- params
LamGetPngInfo (获取图片信息, "get image info") opens a PNG by path and returns everything stored in its metadata as a DICT. For ComfyUI users that metadata is usually gold: the prompt, the workflow JSON, and any custom tags that were embedded at save time. This node turns that metadata from "drag the PNG into the UI and look" into data your graph can actually consume and route.
The workflow-sharing culture that the ecosystem essay describes - "workflow included" PNGs, drag-it-back-to-rebuild - is exactly what this node automates. Instead of loading a PNG into the canvas to reconstruct its graph, you point this node at a file and pull out the embedded parameters programmatically: version it, compare settings, feed a workflow JSON to something that can execute or inspect it, or extract your own custom metadata tags (like the ones SaveImageLam's custom_prompt writes).
How it works
It's a thin wrapper around PIL: Image.open(imgPath) then read .info. That dict contains the text chunks from the PNG - in ComfyUI-saved files, the prompt key holds the workflow as a JSON string, and workflow holds the full UI graph. Note those values are strings; the node returns the raw dict, so if you want to dig into the workflow structure you'll need to json.loads the string yourself (a MultiIntFormula-style eval isn't the way - use a JSON node or a small custom helper).
Inputs and output
imgPath- aSTRINGfilesystem path to the PNG.- Output:
params- aDICTof the PNG's metadata entries.
It's marked as an output node (OUTPUT_NODE = True), which is expected for a node whose whole job is reporting data - but that also means it's terminal on its branch. If you want the metadata and the image to flow on, split the path or read the file elsewhere.
Install
In yanlang0123/ComfyUI_Lam - Manager search "ComfyUI_Lam", or:
cd ComfyUI/custom_nodes
git clone https://github.com/yanlang0123/ComfyUI_Lam
restart. PIL ships with ComfyUI, so there are no extra dependencies to install - the README's install.bat list is unrelated to this node.
Gotchas
The realistic friction points: it only works on files that actually have metadata. Screenshot the image or strip it through a photo editor and the dict comes back near-empty - no error, just nothing useful. And the path must be a real filesystem path, so ComfyUI's own SaveImage-style temp outputs (which live under output/ or temp/ with subfolders) need resolving to the full path first. Also worth knowing: img.info gives you the raw strings - it does not parse JSON for you, so the "I got a dict but can't use the workflow" confusion is almost always a missing json.loads. It's a one-trick node, but for pulling metadata into an automated pipeline it's the right trick.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| imgPath | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| params | DICT | — |