Nodes/ComfyUI_PromptStudio/Prompt Studio Image Source
ComfyUI Node

Prompt Studio Image Source

The node that makes 'edit this image' work

By tiko13·Created 2 months ago·Updated 6 days ago· 3
Prompt Studio Image Source
    • image
    • mask
    image_ref
    source_nameEdit Source

    Prompt Studio Image Source is the input node you swap in when a workflow needs to edit a picture instead of create one. In the normal ComfyUI canvas it's nearly useless on its own - it has no file-picker widget and won't do anything without a valid reference injected into it. Inside Prompt Studio's edit flow, it's the whole mechanism: it loads the exact image you selected in the chat and hands it to the editing pipeline, without copying the file anywhere.

    The job it replaces is Load Image. To build an editing template, you take a working image-editing workflow, replace its Load Image with this node, connect its image output to the edit pipeline, keep a Prompt Slot/Amplify feeding the prompt, and save it with a [PS] prefix. Prompt Studio then recognizes the workflow as an editing template (it checks for a KCPP_ChatImageInput node), and every chat image gets an "Edit this image" action that injects the selected image into this node.

    How it works

    The image_ref input isn't a path - it's a small JSON object that Prompt Studio writes, containing filename, subfolder, and type. The node parses that reference, resolves it against one of ComfyUI's storage roots (input, output, temp, or a dedicated promptstudio folder for dropped-in images), and validates that the path stays inside that root before loading anything. That path check matters: an LLM-heavy pack like this one is exactly where you want to make sure a malicious workflow can't read arbitrary files off disk.

    Two details make it behave well in a workflow:

    • Alpha becomes a mask. If the source has an alpha channel, the node outputs it as a MASK (inverted, ComfyUI style: opaque → 0). A no-alpha image gets an all-zero mask. This plays nicely with inpaint-style edit pipelines.
    • It's content-hash watched. IS_CHANGED hashes the file, so if the referenced image changes on disk the node re-executes instead of serving a stale cached result.

    Inputs: image_ref (injected, leave it alone) and source_name, a label shown when an editing workflow has multiple image inputs. Outputs: image (IMAGE) and mask (MASK).

    Installing it

    It ships with the pack, so it's the usual one-liner:

    cd ComfyUI/custom_nodes
    git clone https://github.com/tiko13/ComfyUI_PromptStudio
    

    Restart ComfyUI, or find "ComfyUI_PromptStudio" in ComfyUI Manager. No pip dependencies, no model downloads - the LLM server (KoboldCpp at http://localhost:5001, Ollama, or llama.cpp) is only involved when Prompt Studio actually runs a prompt through it.

    Where people get burned

    • "Referenced image did not contain a readable frame." The image_ref is empty, malformed, or points at a file that no longer exists. This node is meant to be driven by Prompt Studio - if you're hand-typing refs, you're fighting the design.
    • Using it in a creation workflow. It won't be recognized as an editing template unless you actually need an image input. For plain text-to-image, use a Prompt Slot instead.
    • It doesn't resize anything. It passes pixels through at their original size, which is exactly what edit workflows want - the resolution controls live in the prompt node, not here.
    CategoryKoboldCpp

    Inputs (2)

    NameTypeDefaultDescription
    image_refSTRINGInjected by Prompt Studio. References an existing generated image or sanitized Prompt Studio import without copying it.
    source_nameSTRINGEdit SourceName shown when an editing workflow has multiple image inputs.

    Outputs (2)

    NameTypeDescription
    imageIMAGE
    maskMASK