Nodes/ComfyUI-ZML-Image/ZML_保存图像
ComfyUI Node

ZML_保存图像

Your prompt should live inside the PNG, not in a folder of txt files

By zml-w·Created about a year ago·Updated 2 months ago· 218
ZML_保存图像
  • 图像
  • 图像
  • Help
操作模式保存图像
保存路径output/ZML/%Y-%m-%d
文本块存储
文件名前缀
文件名后缀
使用时间戳true
使用计数器false
生成预览启用
保存同名txt文件禁用
限制图像大小禁用
最大分辨率1024
清除元数据禁用

This is the flagship node of the whole ZML pack - the one the author built first, and the reason everything else exists. ZML_SaveImage is a ComfyUI save node that does what the stock SaveImage does, then adds the trick the pack is built around: it can bake your prompt into the PNG as a hidden text chunk, so the image and its prompt are one file instead of an image plus a folder of txt files that you lose track of.

The name of that feature is 文本块 (text block). You'll see it everywhere in this pack, and it's worth understanding once because it's the spine of the whole thing. When you type your prompt into the 文本块存储 field, the node writes it into a PNG text chunk called comfy_text_block (compressed, so it barely costs file size). ZML's own load nodes read that chunk back, which means you can save an image, drag it into a new workflow later, and get your exact prompt out of it - no sidecar file, no separate note. The PNG spec's text chunks survive as long as nobody re-encodes the file, so keep the original PNG and the prompt stays with it.

The inputs that actually matter

The node has a lot of knobs, but you'll set maybe four of them:

  • 文本块存储 - the prompt (or anything) to embed in the PNG. Leave it empty and you just get a normal save.
  • 保存路径 - defaults to output/ZML/%Y-%m-%d, which becomes output/ZML/2026-08-25/ and so on. It accepts strftime date codes, and it can point anywhere, even outside ComfyUI.
  • 使用计数器 - off by default. When on, filenames get a zero-padded #-#00001 sequence appended. One catch: this counter resets every time you restart ComfyUI, so it's for naming batches, not for "how many images ever."
  • 清除元数据 - strips the embedded ComfyUI workflow graph from the PNG. This is the disk-space lever: pair it with 限制图像大小/最大分辨率 and you can save tiny prompt-carrying images instead of multi-MB ones. The order matters - it strips the workflow first, then writes your text block - so you end up with an image that has your prompt but no graph, which is exactly what you want for archiving.

There's also 操作模式 (保存图像 vs 仅预览图像), filename prefix/suffix, and 保存同名txt文件 (writes the text block as a .txt sidecar too - handy if you later want to feed a dataset, but it only fires when the text block isn't empty).

Outputs and quirks

It returns the 图像 you fed it (pass-through) and a Help string that cheerfully tells you how many images this node has saved in total. The author put a lot of himself in here.

Two quirks worth knowing. First, filename components are joined with #-# (prefix#-#timestamp#-#00001#-#suffix), and other ZML text nodes know how to split on that - you can recover the prefix or suffix of a filename downstream. Second, the node deliberately refuses to save 1x1 placeholder images and pure-black 64x64 ones. That's a compatibility feature: ZML's image-pause node emits a 1x1 placeholder on the outputs you didn't pick, and this save node ignores those instead of cluttering your folder with black squares.

Install and gotchas

Install via ComfyUI Manager (search "ComfyUI-ZML-Image") or cd ComfyUI/custom_nodes && git clone https://github.com/zml-w/ComfyUI-ZML-Image, then restart. The requirements.txt pulls in some heavy stuff (ultralytics, opencv-python) for the pack's other nodes, but this one only needs what ComfyUI already has. The UI labels are in Chinese - grab the English patch before you get confused.

Where people get burned: if the file you load back was re-encoded (screenshotted, re-uploaded, converted to JPEG), the text block is gone with everything else - PNG only. And if you turn on 清除元数据 and later expect to drag the PNG back onto the canvas to reconstruct the workflow, that's gone by design. Choose per run: keep the graph, or keep it lean.

Categoryimage/ZML_图像/图像

Inputs (13)

NameTypeDefaultDescription
操作模式COMBO保存图像2 options: 保存图像, 仅预览图像
保存路径STRINGoutput/ZML/%Y-%m-%d
文本块存储STRING
文件名前缀STRING
文件名后缀STRING
使用时间戳BOOLEANtrue
使用计数器BOOLEANfalse
生成预览COMBO启用2 options: 启用, 禁用
保存同名txt文件COMBO禁用2 options: 启用, 禁用
限制图像大小COMBO禁用2 options: 禁用, 启用
最大分辨率INT10248–8888
清除元数据COMBO禁用2 options: 禁用, 启用
图像optIMAGE

Outputs (2)

NameTypeDescription
图像IMAGE
HelpSTRING