ComfyUI Node

Image to Text

Drop in an image, get a caption — if you can get it running

By yolanother·Created 3 years ago·Updated 2 years ago· 20
Image to Text
  • image
  • STRING

One image in, one sentence out

The whole pitch fits in a sentence: wire an image into this node and a text description pops out the STRING socket. That's it. It's the "image as prompt" trick people keep googling for - someone on r/comfyui was literally trying to do that with this exact node back in January 2024. You can feed a reference image into an img2img loop, caption a folder of training data, or just find out what a render actually contains without squinting.

Set expectations before you get excited: what comes out is a descriptive sentence, not a ready-to-paste prompt. BLIP's default behavior is unconditional captioning - no max length, no prompt prefix, no temperature control anywhere in this node. You'll still be massaging the text into prompt form. That's fine, but know what you're signing up for.

How it actually works

Under the hood it's the Salesforce BLIP image-captioning-large model, loaded through HuggingFace transformers. Here's the part most people don't expect: the model loads at module import time, not when you run the node. The first time ComfyUI starts after you install this pack, it downloads roughly a gigabyte of weights and shoves them onto your GPU with a hardcoded .to("cuda"). Every call then runs model.generate() on your image and decodes the caption with special tokens skipped. You'll also see Image appears to be: ... printed to the ComfyUI console - that's how the author designed it to be read, apparently.

One quirk worth knowing: this node doesn't define IS_CHANGED, so feed it the same image twice and ComfyUI is happy to hand you the cached caption instead of re-running the model. That's usually what you want. (The URL sibling in this pack does define it, because there a re-run is the point - more below.)

The inputs that matter

There's exactly one required input, straight from the schema:

  • image - the standard ComfyUI IMAGE tensor. That's your whole input surface. No optional parameters, no settings.

Output: a single STRING - the caption. Wire it into anything that eats text: a display node, a CLIPTextEncode prompt, a file writer.

Installing it

ComfyUI Manager is the easy path - search for "Image to Text" (the pack title is "Image to Text Node") and install. Or do it by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/yolanother/DTAIImageToTextNode

Then restart ComfyUI. Don't trust the README's "Dependencies: ComfyUI" line. The shipped requirements.txt lists only requests, but the node actually needs transformers (and torch, which you already have). If the pack fails to load with a No module named 'transformers' error, that's why:

pip install transformers

First startup after that downloads the BLIP model from HuggingFace, so give it a minute.

Where people get burned

  • The missing-dependency trap above. It's the most common way this pack fails to load, and the README won't warn you.
  • CUDA or nothing. .to("cuda") is hardcoded. No CPU fallback, no Apple Silicon path. On a Mac or CPU-only box, loading the pack throws at startup.
  • The model loads even if you never use the node. Eager import-time load means a ~1 GB download and a chunk of VRAM the moment ComfyUI starts, whether you caption anything or not.
  • The IMAGE input gets no PIL conversion. The code passes your raw ComfyUI tensor straight into BLIP's processor, unlike the URL variant which opens a proper PIL image first. It's the most fragile half of the pack, and matches the one real-world report I found of it erroring out. If it throws, that mismatch is the first place I'd look.

The honest take

This is a 2023-era node and it shows. BLIP-large still works, but the caption slot has better tenants now - WD14 taggers for tag-style output, Florence-2 or Qwen2-VL caption nodes if you want clean sentences. Reach for this one if you want something tiny, dependency-light (after you add transformers), and you know exactly what you're getting: a plain sentence about whatever's in the image.

CategoryDoubTech/Image/Image To Text

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (1)

NameTypeDescription
STRINGSTRING