Nodes/ComfyUI Serving toolkit/Serving Input Text & Image
ComfyUI Node

Serving Input Text & Image

One node that hands you both the prompt and the attached image

By matan1905·Created 3 years ago·Updated about a year ago· 71
Serving Input Text & Image
  • serving_config
  • default_image
  • STRING
  • IMAGE
argumentprompt
default_prompt

ServingInputTextImage is the combo node: it pulls both the text argument and the attached image out of a request in one shot. Where most serving workflows wire up a ServingInputText for the prompt and a ServingInputImage for the attachment as two separate nodes, this one returns a STRING and an IMAGE together - which is exactly the pair you need for image-to-image. It's the node to reach for when your command is "here's a photo and a caption, remix it."

It's basically the two input nodes fused, and the behavior matches. The text side reads the argument you name from the request (default prompt - the free text the user typed). The image side grabs attachment_url_0, downloads it, and emits a normalized IMAGE tensor. Both defaults exist so the node degrades gracefully: default_prompt is used when the user supplied no text for that argument, and the optional default_image is used when there's no attachment. Wire a default_image (say, a placeholder) and a single branch handles both a bare prompt and a prompt-plus-photo without any extra routing.

One quirk worth respecting: if there's no attachment and no default_image, the node replies "This command requires an image" through the serving layer and interrupts the workflow run. The image is treated as the required half; the text is happy to fall back to a default. If your users are the type to forget attachments, give it a default_image or you'll be fielding "why did it stop?" messages.

Inputs:

  • serving_config - the config from your entry point node.
  • argument - text argument to read, default prompt.
  • default_prompt - fallback text.
  • default_image (optional) - fallback image.

Outputs: STRING (the text) and IMAGE (the image tensor), in that order.

Since the two outputs are just the standard ComfyUI types, you can split them anywhere: STRING into a CLIP text encoder or prompt template, IMAGE into a VAE Encode for img2img, a ControlNet, or an IPAdapter. That's the whole point - one node, both halves of the img2img equation, no adapter nodes in between.

The implementation detail that keeps it lean: the image path goes through OpenCV, so the pack's opencv-python dependency (installed with pip install -r requirements.txt) is doing the decode work, and the whole thing runs on the pack's standard install - ComfyUI Manager, or clone into custom_nodes. No models to download, no extra packages. And the pack-wide rule still applies: Auto Queue on, or the node processes a single request and goes dormant.

CategoryServing-Toolkit

Inputs (4)

NameTypeDefaultDescription
serving_configSERVING_CONFIG
argumentSTRINGprompt
default_promptSTRING
default_imageoptIMAGE

Outputs (2)

NameTypeDescription
STRINGSTRING
IMAGEIMAGE