Nodes/Quality of Life Nodes for ComfyUI/JSON Image Decoder (Soze)
ComfyUI Node

JSON Image Decoder (Soze)

The other direction — text back into an image batch

By SozeInc·Created 2 years ago·Updated 8 days ago· 10
JSON Image Decoder (Soze)
    • image
    • count
    • status
    encoded

    Everything in the Soze JSON family that encodes an image to text has a matching decoder on the other side, and JSON Image Decoder (Soze) is it: one STRING in, an IMAGE batch out. It's the node you put at the edge of a workflow when images arrive as text - pulled out of an API response, read from a JSON file, handed over from a node that returns image_urls as a string - and you need them back as tensors you can preview, feed to a VAE, or batch-process.

    What makes it genuinely useful is how permissive the input is. It accepts a single data URI (from the encoder), a single file path, a single http(s):// URL (it fetches it over the network), a JSON-encoded array of any of those, or a newline-separated list. That last one matters: the source explicitly calls out that it handles the FAL nodes' image_urls string output. Whatever shape the text comes in, you can usually just wire it in.

    How it works

    The string is split into a list of values (JSON array or newline split, falling back to a single value), then each one is decoded: data URIs get base64-decoded and opened via PIL, URLs are fetched with requests, everything else is treated as a file path. Each frame is converted to a [1, H, W, 3] float tensor and all frames are stacked into one batch. Here's the hidden behavior that saves you from a crash: frames of differing sizes are bilinear-resized to match the first frame, so a mixed set of images still produces one clean batch instead of a tensor-shape error.

    Inputs and outputs

    • encoded - required STRING: data URI, file path, URL, JSON array, or newline-separated list.

    Outputs: image (the IMAGE batch), count (INT - how many frames were decoded), and status (STRING - OK: decoded 5/5 value(s), size=1024x768, with per-value failure details appended if some failed).

    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. Fetching URLs uses requests, which the pack already depends on.

    Gotchas

    If every value fails to decode, you get a 64×64 blank image, count=0, and an ERROR: status with the per-value details - it doesn't throw and kill the workflow, so read the status string. Partial failures behave the same way: the good frames come back, the bad ones are listed in status. The resize-to-first-frame behavior is convenient but lossy - if you're round-tripping images that must keep exact dimensions, make sure they're the same size before encoding. And blank input produces a skip status rather than an error, which is nice for optional-image slots.

    CategorySoze Nodes/JSON

    Inputs (1)

    NameTypeDefaultDescription
    encodedSTRINGData URI, file path, URL, JSON array, or newline-separated list.

    Outputs (3)

    NameTypeDescription
    imageIMAGE
    countINT
    statusSTRING