Nodes/ComfyUI-ZML-Image/ZML_分类图像
ComfyUI Node

ZML_分类图像

Sort your images by what's hiding in their metadata

By zml-w·Created about a year ago·Updated 2 months ago· 218
ZML_分类图像
  • 图像
  • 无数据
  • 元数据
  • 文本块
图像路径

You've downloaded a folder of images and you want to split them into "has my prompt data," "has the workflow," and "totally naked PNG." ZML_ClassifyImage (ZML_分类图像) does exactly that: it reads each image's PNG metadata and routes it to one of three outputs depending on what's stored inside. It's a sorter for the invisible layer that every ComfyUI image carries around in its own file.

What it is

A metadata-classifier from ComfyUI-ZML-Image, and it's tightly tied to this pack's core obsession: the "text block" (comfy_text_block), a compressed PNG text chunk the pack's save nodes use to store your prompt alongside the image. The node takes a path plus the image itself and sorts it into three buckets. The inputs:

  • 图像路径 (STRING) - and the tooltip is the ground truth here: wire in the 图像路径 output from the pack's "从路径加载图像" (load image from path) node. The classification reads the file on disk, so it needs a real path to inspect metadata.
  • 图像 (IMAGE) - the pixel data, passed through to whichever bucket wins.

Outputs - three image outputs, and exactly one activates per input image:

  • 无数据 (no data) - the PNG has no embedded info at all.
  • 元数据 (metadata) - it has some metadata (like a workflow or prompt chunk) but no ZML text block.
  • 文本块 (text block) - it has a comfy_text_block chunk, i.e. prompt data saved the ZML way.

How it works

The node opens the file with PIL and checks its info dictionary. No info at all → 无数据 bucket. Info present and the comfy_text_block key is in there → 文本块 bucket. Anything else with metadata → 元数据 bucket. The clever part is execution control: the two inactive outputs get ExecutionBlockers, so the branches you didn't pick simply don't run. Wire each output to a different save node and one pass through a batch sorts the whole folder into three piles, ready for different handling.

Install and gotchas

Standard pack install:

cd ComfyUI/custom_nodes
git clone https://github.com/zml-w/ComfyUI-ZML-Image

or ComfyUI Manager → ComfyUI-ZML-Image, restart. No models needed.

The gotchas are metadata-shaped. First, and most important: the classification depends on the path being valid - feed it a path that doesn't resolve and every image lands in the no-data bucket silently. Second, "metadata" here means whatever PNG text chunks exist: a standard ComfyUI save carries both workflow and prompt chunks, so those go to the 元数据 bucket, while only images saved by ZML's own save nodes (or anything writing the same comfy_text_block key) hit the 文本块 bucket. Third, the 无数据/元数据/文本块 labels are Chinese - English patch at github.com/zml-w/ZZZ_ZML_English_Patch. The image-io layer has the full story on why this metadata survives re-encoding or doesn't: recompressing a PNG can strip these chunks, which is exactly the kind of thing this node will happily sort into "no data." One-person pack, no English community - the tooltip and a couple of README example workflows (the pack ships a 分类图像.json) are your docs.

Categoryimage/ZML_图像/工具

Inputs (2)

NameTypeDefaultDescription
图像路径STRING请将'从路径加载图像'节点的'图像路径'输出接入到这里
图像IMAGE

Outputs (3)

NameTypeDescription
无数据IMAGE
元数据IMAGE
文本块IMAGE