ComfyUI Node

Set Int Extra

Stash an integer in your image metadata, and get it back later

By kinorax·Created 5 months ago·Updated about a month ago· 2
Set Int Extra
  • extras
  • extras
key
value0

Set Int Extra writes an integer keyvalue pair into the pack's metadata extras - the extra parameter lines embedded in the A1111 infotext when you save with Image Saver. It's the integer sibling of Set Float Extra, and if you've read that node, the shape here is identical: a key, a value, and an optional incoming extras bundle to build on.

The case for it is the same as the rest of the family: make the numbers you care about survive a save/load round-trip. Ints are arguably the most common thing you'll want to persist that has no native infotext home - steps, a batch index, a crop coordinate, a clip skip, an explicit model count, any whole number that meant something when you tuned the workflow. Write it as an extra, save the image, reload later, and the number is right there.

Inputs and outputs

  • key - the parameter line key.
  • value - the integer (full 64-bit-ish range, from roughly -9.2e18 to 1.8e19, so seeds and the like fit comfortably).
  • extras (optional) - the existing extras bundle to merge into.

Output is the merged extras bundle, ready to chain into the next Set node or into Image Info Context.

That's the whole surface. One less knob than the float version - no decimals, because an integer has nothing to round. If you find yourself wanting to store a number with fractional precision, that's the float node's job; this one is strictly for whole values, and that simplicity is the point.

How it fits the wider picture

The Set nodes in this pack are deliberately dumb: they add a key to a dict and hand the dict onward. All the cleverness lives in what happens around them - Image Info Context merges your extras into image_info.extras (duplicate keys overwritten by input-side values), Image Saver serializes everything into the infotext, and Image Reader reconstructs it on load. The matching Get Int Extra node pulls your key back out and returns the value as a real integer you can wire into a sampler, a count node, or anything that takes an INT.

So the workflow you're building toward is: Set the value, save, reload, Get the value, and use it - not just admire it in a text file.

Install

Standard pack install:

cd ComfyUI/custom_nodes
git clone https://github.com/kinorax/comfyui-info-prompt-toolkit.git
cd comfyui-info-prompt-toolkit
pip install -r requirements.txt

Or ComfyUI Manager → search "ComfyUI-Info-Prompt-Toolkit" → install → restart. No models or extra dependencies.

Where people get burned

The classic gotcha is treating extras as a database - they're not. It's a flat dict of text lines inside image metadata; no namespacing, no nesting, and duplicate keys silently overwrite. Pick names that are unique within a workflow, and remember that nothing is persisted unless a pack saver is actually writing the file. A plain Save Image node drops your extras on the floor. And when you reload, the value comes back as the string it was stored as - always round-trip through the matching Get node so you're handling a typed integer, not a text string with a number in it.

CategoryInfo-Prompt-Toolkit/ImageInfo

Inputs (3)

NameTypeDefaultDescription
keySTRINGParameter line key
valueINT0-9223372036854776000–18446744073709550000Parameter line value
extrasoptIPT-ImageInfoExtras

Outputs (1)

NameTypeDescription
extrasIPT-ImageInfoExtras