Nodes/ComfyUI Stash/Stash Image
ComfyUI Node

Stash Image

Grab any image from your Stash library straight into the graph

By zyquon·Created about a year ago·Updated 2 months ago· 2
Stash Image
  • stash
  • IMAGE
  • id
  • count
id_or_url
search
tags
offset0

Copy a URL from the Stash web UI, paste it into this node, hit run, and the image is sitting on the canvas as a normal IMAGE tensor. That's the whole pitch: Stash Image turns your self-hosted Stash library - the organizer for "gentlemen's special-interest content," as the README puts it - into a first-class input source for ComfyUI, with no file export, no drag-and-drop, no hunting through folders.

Once the image is in the graph it's just pixels, so it wires into anything: img2img, upscaling, inpaint, an IP-Adapter reference, or the source image for a ReActor face swap. If you keep your library tagged in Stash, this is how you stop leaving the organizer to fetch files by hand.

How it works

The node needs the stash connection from a Stash Server node, then queries Stash's GraphQL API using whichever search parameters you filled in. Here's the important part: the results of all the parameters you give it are ORed together, deduplicated, and sorted into one list - so id_or_url and search and tags all contribute matches. offset then picks which one you get (0 is the first). It downloads the chosen file over HTTP using the same API key from your settings, decodes it, and pushes the frames out.

Two details worth knowing. First, the download happens on every run - there's no caching in the node, so a batch loop re-fetches the file each time. Second, animated webp and GIF files are split into every frame as an image batch, which is a nice surprise for a node that otherwise reads like a simple loader.

The inputs that matter

Only one is required; the rest are "fill in whichever of these describes the image you want":

  • stash (required) - the STASH connection from Stash Server. Forgetting this is the most common wiring mistake.
  • id_or_url - the killer feature. Paste a Stash web UI URL for an image and the node pulls the ID out of it. Or paste a bare ID, or a comma-separated list of IDs.
  • search - the same query you'd type in Stash's search bar, handy for filename or folder matches.
  • tags - comma-separated tag names. Note the case-sensitivity: Stash tags are matched exactly, so Blonde and blonde are not the same.
  • offset - which of the ORed results to take. Default 0, and it must stay below count.

Outputs

  • IMAGE - the image tensor (or frame batch for animated files).
  • id - the Stash image ID that was actually used, useful for testing which match you hit.
  • count - how many images matched the query in total. This is your signal for offset: if offset is greater than or equal to count, you get an out-of-bounds warning.

Installing and setting up

cd ComfyUI/custom_nodes && git clone https://github.com/zyquon/ComfyUI-Stash

or search "Stash" in ComfyUI Manager, then restart. The pack has no heavy dependencies (pillow, numpy, requests) and no model files - but Stash Image is useless until you configure the Stash connection: gear icon → Stash section → set the API URL (http://localhost:9999/graphql, keep the /graphql path) and paste the API key from Stash's security page. The Stash Server node will loudly refuse to connect until you do.

Common issues

  • Empty result, count is 0 - no image matched. Try just id_or_url by itself; if a search string returns nothing, Stash's search syntax may not be matching what you think.
  • Offset ... is out of bounds - your offset is past the end of the deduped result list. Check count and lower it.
  • A tag query silently returns nothing - case-sensitivity. Stash's exact-match tags don't forgive Big vs big.
  • Slow loops - the node re-downloads every run with no cache, so for batch jobs consider pulling once and saving to disk, or accepting the round trip. A 403 or non-200 response throws explicitly, so a bad key shows up as an error here, not a black image.
CategoryStash

Inputs (5)

NameTypeDefaultDescription
stashSTASHA Stash server connection
id_or_urloptSTRINGThe image ID or a URL from the UI
searchoptSTRINGA search as when running in the Stash UI
tagsoptSTRINGOne or more tags associated with the image, comma-separated
offsetoptINT0Offset to use if the query returns more than one image (0 is the first image)

Outputs (3)

NameTypeDescription
IMAGEIMAGE
idINT
countINT