Nodes/D2 Nodes ComfyUI/D2 Load Image
ComfyUI Node

D2 Load Image

Load Image that reads back the prompt — including A1111 and NovelAI files

By da2el-ai·Created 2 years ago·Updated 29 days ago· 66
D2 Load Image
  • editor
  • IMAGE
  • MASK
  • width
  • height
  • positive
  • negative
  • filename
  • filepath
  • pnginfo
image
image_path

The stock LoadImage gives you pixels. D2 Load Image gives you pixels and the prompt that made them. It reads the embedded metadata from a PNG, JPEG or WebP and hands you the positive and negative prompts as plain strings, ready to wire straight into a sampler. For anyone who's ever wanted to "take this image and remix it," it removes an entire copy-paste step. It's compatible with images saved by A1111 (including Forge variants) and NovelAI, which makes it the node you want when someone drops a webui PNG in a Discord and you want to know what they used.

How it works

It's a LoadImage that's also a metadata reader. Under the hood it decodes the image normally, then reads the prompt block from the file's embedded metadata - the same chunk that D2 Save Image (from this pack) writes out in A1111 style. Because NovelAI and A1111 write their parameters in that format, those files come through too. If an image has no recognizable metadata, you just get empty strings and the IMAGE/MASK outputs, which is a graceful enough failure.

A note on the combo selector: the image dropdown lists files from your input folder as usual, but there's also an image_path input. Feed it a full path and it'll load that file directly - that's the intended hook for folder-queue style nodes that hand you file paths one at a time. The editor button opens the mask editor, which brings us to the one real trap.

The mask editor trap

The docs are upfront about this and it's worth repeating: if you edit the image with the mask editor, the metadata is destroyed. ComfyUI swaps in a freshly written copy of the file, which has no prompt chunk, so positive and negative come back empty. Clearing the mask doesn't undo it - the swap already happened. The workaround the author suggests is simple: keep a dedicated D2 Load Image for prompt extraction and never touch its editor. If you need a mask, use a second Load Image instance for that.

The outputs

Nine outputs, but really only a handful matter:

  • IMAGE / MASK - the pixels and the mask, like stock.
  • positive / negative - the extracted prompts. The headline feature.
  • width / height - handy for sizing an Empty Latent to match without extra nodes.
  • filename / filepath / pnginfo - the file's name, full path, and raw metadata text, for logging or filename-driven logic.

Installing

Part of D2 Nodes ComfyUI:

cd ComfyUI/custom_nodes
git clone https://github.com/da2el-ai/D2-nodes-ComfyUI

or search "D2 Nodes ComfyUI" in ComfyUI Manager. No model downloads.

Troubleshooting

  • Empty prompt on a webui PNG - either the image was edited (mask editor), or it's a format whose metadata this node doesn't read. Double-check by loading the raw file with a fresh node.
  • Image won't load from a path - image_path expects an absolute local path; the pack resolves paths inside ComfyUI's managed folders first, and uses your path verbatim otherwise.
  • Remixing workflows - wire positive/negative into D2 KSampler's text inputs and you've got a one-wire img2img remix. Add D2 XY Prompt SR on the extracted prompt and you can grid-vary it.

For img2img and "what did they use" workflows, this quietly becomes one of the most-used nodes in the pack - mostly because you stop noticing it's there.

CategoryD2/Image

Inputs (3)

NameTypeDefaultDescription
imageCOMBO1 options: example.png
image_pathoptSTRING
editoroptD2_BUTTON

Outputs (9)

NameTypeDescription
IMAGEIMAGE
MASKMASK
widthINT
heightINT
positiveSTRING
negativeSTRING
filenameSTRING
filepathSTRING
pnginfoSTRING