Nodes/Substitute BackEnd/SubstituteBackendLoadImage
ComfyUI Node

SubstituteBackendLoadImage

A Load Image Node That Won't Accept a Path (On Purpose)

By Artificial-Sweetener·Created 3 months ago·Updated 15 days ago· 0
SubstituteBackendLoadImage
    • IMAGE
    • MASK
    image

    Open this node and you'll find a single input called image - a plain text box with an empty default. Try to type a path into it and it will refuse. That's not a bug and it's not a broken download; the name is doing double duty, and the thing that's supposed to sit in that box is not a path at all.

    SubstituteBackendLoadImage is the execution half of a two-step image loader that powers SugarSubstitute, a Qt-based alternative front-end for ComfyUI by the same author (it hit beta on r/comfyui in mid-2026). When you drop a local image onto SugarSubstitute's canvas, the app doesn't just embed the file path into the workflow graph. Instead it calls a route the backend registers - /substitute/v1/local-assets/authorize - passing the absolute path plus a SHA-256 of the file, and gets back an opaque authorization token. That token is what lands in this node's image field. The path never touches the graph.

    How it works

    The backend keeps an in-memory registry of authorized files, one entry per token. Each token is short-lived (about an hour) and, at resolve time, the file is re-checked against its size, mtime, device, and inode - so a file that got replaced after authorization is rejected rather than silently loaded as different content. The node validates the token before the graph even runs, and its cache key (IS_CHANGED) is driven by the file's content hash, which means ComfyUI re-runs it exactly when the actual pixels change and not when the token does. That's the same IS_CHANGED mechanic that underlies every "reload this file each run" loader in the ecosystem, just aimed at a token instead of a widget.

    When it does execute, it decodes the file with PIL - EXIF-transposed, flattened to RGB, frames batched into one tensor - and emits plain, standard Comfy values.

    The inputs and outputs

    Only one thing to set, and one thing to understand:

    • image (STRING) - the authorization token, not a file path. If you see this node in a workflow you're reading, this is what the value is: opaque, random, and meaningless outside the running backend.
    • IMAGE - the decoded image, batched on the first dimension.
    • MASK - the inverted alpha channel (1.0 - alpha), matching core LoadImage's convention where 1 = opaque. Feed it to any inpainting or detailer node and it behaves like a mask you painted.

    Install

    You're not really installing this for the node - you're installing the backend it belongs to. Via ComfyUI Manager, search for "Substitute BackEnd". Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Artificial-Sweetener/Substitute-Backend.git
    cd Substitute-Backend
    # into your ComfyUI venv
    python -m pip install -e .
    

    Python 3.12+ is required, with aiohttp, requests, and sugar-dsl pulled in automatically. There are no model downloads and no heavy runtime deps - the pack is deliberately "not node-first," and its real surface is the /substitute/v1/... HTTP routes it registers. Restart ComfyUI after installing.

    Gotchas

    • If you're not using SugarSubstitute, skip it. These execution nodes are useless when driven by hand; core LoadImage is what you want. They exist so the front-end can feed files into ComfyUI without handing the graph arbitrary paths.
    • "Invalid or expired" validation errors mean the token is stale (they live about an hour) or the file on disk changed after authorization. Going back to the front-end and re-selecting the image is the fix - the token gets reissued.
    • Authorization is loopback-only by design, so don't expect the routes to accept calls from other machines.

    In other words: this is a piece of plumbing, and honest plumbing at that. If you ever see SubstituteBackendLoadImage in a shared workflow, that's what it is - a secure door into ComfyUI, not a file browser.

    CategorySubstitute/execution

    Inputs (1)

    NameTypeDefaultDescription
    imageSTRING

    Outputs (2)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK