NAI 图片元数据读取
Reclaim the prompt from a PNG instead of squinting at the pixels
- 正面提示词
- 负面提示词
- 元数据JSON
In this ecosystem the metadata is the file - a PNG carries its entire generation story as text chunks, and ComfyUI's convention is that the workflow rides along inside the image. NAI 图片元数据读取 (Image Metadata Reader) is that idea pointed at NovelAI. Give it a path to a PNG and it reads the NovelAI-style metadata out of it, spitting back a ready-made NAI_POSITIVE_PROMPT, a NAI_NEGATIVE_PROMPT, and the raw metadata JSON. The upshot: you can take an image someone posted - or one you generated last week and lost the workflow for - and feed its actual prompt straight back into a sampler.
The node is one string input, image_path, and you give it an absolute path to the file (Path-style, ~ expands). It reads the PNG's text chunks via Pillow, then layers the pack's own read_nai_metadata parse on top, so it understands both the pack's own saver output and compatible NovelAI image info.
Outputs
- 正面提示词 - a
NAI_POSITIVE_PROMPTobject, directly wireable into any sampler's positive socket. - 负面提示词 - the same, for negative.
- 元数据JSON - the full metadata blob (PNG info plus the parsed comment) as a string. This is the honest raw view; the two typed outputs above are conveniences on top of it.
The flow that makes this worth having: read an image → wire the recovered prompt into an img2img or Enhance node → rework the thing without retyping the prompt. It's also how you verify what actually went into a generation, which matters on a paid API where the difference between "I set X" and "X actually shipped" is measurable in Anlas.
Install and the honest limits
Standard pack install - search ComfyUI-NovelAI-GENYTOOLS in ComfyUI Manager or git clone it into custom_nodes + pip install -r requirements.txt, token in settings.
The limits are the metadata law and it applies here exactly as it does to local workflows: if the file was re-encoded, the metadata is gone and no reader resurrects it. Re-encoded JPEG, a Reddit re-serve, a screenshot - all empty. This reader works on PNGs that still carry their text chunks, which means files saved by the pack's own NAI 图片保存器, or NovelAI-compatible originals you got straight from the source. Don't blame the node when a host stripped the payload before you ever saw the file.
One more thing worth knowing: the pack's saver deliberately does not write the ComfyUI workflow into images by default (privacy by design - your token and full graph stay out of the file). So this reader recovers the prompt and parameters, not an editable node graph. If you wanted the graph too, that's the include_comfy_workflow toggle on the saver, which is off for a reason.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image_path | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| 正面提示词 | NAI_POSITIVE_PROMPT | — |
| 负面提示词 | NAI_NEGATIVE_PROMPT | — |
| 元数据JSON | STRING | — |