Nodes/comfyui-get-meta/Get Int from Image
ComfyUI Node

Get Int from Image

Steal the exact seed from any ComfyUI image

By shinich39·Created about a year ago·Updated 5 months ago· 9
Get Int from Image
  • image
  • INT
query
int0

The seed is the thing people most often want back from an image, and this is the node that hands it to you. Get Int from Image is part of shinich39's comfyui-get-meta pack: feed it a generated PNG, tell it which integer to look for, and it extracts that value from the metadata embedded in the file.

Here's the workflow that makes people happy: someone posts an image with "workflow included" (the community norm for ComfyUI - the whole graph is baked into the PNG). You drag it into ComfyUI and get their full workflow back, which is often a mess of missing custom nodes and settings you don't want. Instead, load just the image with a LoadImage, drop this node in, and pull out the single number you actually want - the seed - then keep your workflow and regenerate with it. Same seed, your settings, your models. That's the killer use case.

How it works

Like every node in the pack, the Python side is a thin passthrough that echoes a widget value. The smarts live in the frontend: the extension traces the image loader feeding the image input, asks ComfyUI's backend to read the file's embedded metadata, parses the stored prompt JSON, and drops the queried widget's value into the int widget. The node hardcodes IS_CHANGED to always re-run, so the freshly pulled number actually propagates each time you queue. No pixels are examined; this is pure metadata archaeology.

The inputs and output that matter

  • image - wire from a supported loader: core LoadImage/LoadImageMask, Inspire Pack's "LoadImage //Inspire", Crystools' "Load image with metadata [Crystools]", or WAS Node Suite's "Image Load".
  • query - what you want. The README's format is NODE_TYPE.WIDGET_NAME, with a # prefix for node IDs. The classics:
    • #4.seed - the seed by node ID
    • KSampler.seed - by node type (add [0] if there are several KSamplers, or match by title)
    • KSampler.steps or KSampler.batch_size - if you want those back too
  • int - the result widget, default 0. Don't hand-type it; a run overwrites it.

The single INT output plugs into any integer input: seed, steps, batch_size, whatever.

Installing it

ComfyUI Manager → search comfyui-get-meta → Install, restart. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/shinich39/comfyui-get-meta

Then restart ComfyUI. No models, no heavy dependencies - just Pillow (already there) and a bundled JSON5 parser. It's about as dependency-free as a custom node gets.

Common issues

  • The value stays 0. The image has no embedded metadata - saved via a "without metadata" node, re-hosted, or screenshot. Nothing to read, so you get the default. Verify the image actually carries a workflow by dragging it into ComfyUI and checking the workflow comes back.
  • Wrong loader. An unsupported loader (video frame, URL fetch) means no file path, so no fill.
  • It's a UI feature. Values are injected by the browser on connection change or when a prompt is queued; a headless API call gets the default. If you script ComfyUI directly, this isn't the tool.

One note: values come from the prompt JSON - what actually executed - not the workflow's UI state. If someone saved after tweaking widgets, the executed seed is the one you want anyway, and that's the one you get.

Categoryimage

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
querySTRING
intINT0

Outputs (1)

NameTypeDescription
INTINT