Nodes/Quality of Life Nodes for ComfyUI/JSON Chain Image Array Pair (Soze)
ComfyUI Node

JSON Chain Image Array Pair (Soze)

Every frame, in order, as a JSON array

By SozeInc·Created 2 years ago·Updated 8 days ago· 10
JSON Chain Image Array Pair (Soze)
  • image
  • chain_in
  • chain_out
name
modedata_uri
formatpng
jpeg_quality95
save_path

A batch of images - an animation's frames, several reference shots, an upscale's tiles - is the case where you want all of them in your JSON, in order, and the single JSON Chain Image Pair deliberately stops at the first frame. JSON Chain Image Array Pair (Soze) doesn't: it walks every frame of the IMAGE batch and adds one encoded entry per frame to a JSON array under your name. One input socket, an array out the other side.

This is the node for API calls that take multiple images - reference sets, frame sequences, image-lists for video tools. It reuses the exact encoding machinery of the single Image Pair (same data_uri/filepath modes, same png/jpeg/webp formats), so the trade-offs are identical, just applied per frame.

How it works

The IMAGE batch is [B, H, W, C]; the node loops over the batch dimension and encodes each frame. In data_uri mode you get an array of base64 strings. In filepath mode, each frame is written to disk with a guaranteed-unique name - the source notes it always appends a per-frame _NNNNN counter so an earlier frame is never overwritten - and the value is an array of absolute paths. Blank batches produce an empty array rather than an error.

Inputs and outputs

  • name - required string widget, the JSON key.
  • image - required IMAGE input (forced). All frames are encoded.
  • mode - data_uri or filepath.
  • format - png, jpeg, or webp.
  • jpeg_quality - only used for jpeg/webp.
  • save_path - filepath mode: target path; each frame gets its own _NNNNN suffix.
  • chain_in - optional JSON_PAIRS.

Output: chain_out. A 12-frame batch with mode=data_uri gives you something like:

{"frames": ["data:image/png;base64,....", "data:image/png;base64,....", "..."]}

Installing it

Part of the Soze pack:

cd ComfyUI/custom_nodes
git clone https://github.com/SozeInc/ComfyUI_Soze.git
pip install -r ComfyUI_Soze/requirements.txt

Restart ComfyUI, or search ComfyUI_Soze in ComfyUI Manager.

Gotchas

Size multiplies: 24 frames at 1MB of base64 each is a 24 MB JSON string, and that will break a lot of HTTP APIs. For frame-heavy payloads, filepath mode is usually the pragmatic answer - or drop to JPEG with a modest jpeg_quality. Also be aware the array is ordered by batch position, which is what you want for sequences, but it's on you to make sure the upstream batch order matches what the API expects. And decode on the other end is a known quantity: the JSON Image Decoder accepts this exact array format and stacks it back into an IMAGE batch.

CategorySoze Nodes/JSON

Inputs (7)

NameTypeDefaultDescription
nameSTRING
imageIMAGE
modeCOMBOdata_uri2 options: data_uri, filepath
formatCOMBOpng3 options: png, jpeg, webp
jpeg_qualityoptINT951–100Only used for jpeg / webp.
save_pathoptSTRINGfilepath mode: target path. Each frame gets its own _NNNNN suffix.
chain_inoptJSON_PAIRS

Outputs (1)

NameTypeDescription
chain_outJSON_PAIRS