Nodes/ComfyUI-LexTools/ImageCaptioning
ComfyUI Node

ImageCaptioning

Let BLIP tell you what the image actually is

By SOELexicon·Created 3 years ago·Updated about a year ago· 33
ImageCaptioning
  • image
  • STRING

Point this node at an image and it hands you back a plain-English description of what's in it: "a woman in a red dress standing in front of a brick wall." No API key, no cloud call, no account - it runs the BLIP model locally inside ComfyUI. One input, one string output, done.

The honest use cases are more boring than you'd hope and more useful than you'd expect. Captioning generated images for a LoRA dataset is the big one - if you're building training data, you need a text description per image, and BLIP is the cheap, classic way to bootstrap those captions (you'll want to hand-edit them, but it's a starting point that saves hours). It's also handy for auto-tagging outputs as they're saved, or for building a text-based search over a folder of generations.

How it works

It's the BLIP (Bootstrapping Language-Image Pre-training) model from the HuggingFace transformers ecosystem, loaded and run inside the node. The image gets preprocessed, passed through BLIP's vision-language encoder, and the model generates a caption autoregressively. First run downloads the BLIP weights from HuggingFace, so you need network the first time; after that it's cached and runs locally.

Inputs and outputs are minimal:

  • image - the IMAGE to caption.
  • STRING - the generated caption.

That's the whole node. What you do with the string is up to you - feed it into a text node to display it, write it to a file, or pipe it into a prompt.

The honest trade-offs

BLIP captions are descriptions, not tags, and they skew generic. You'll get "a man sitting at a desk" rather than "1girl, desk, office, suit". If you're captioning for an anime or tag-based LoRA, BLIP's style is a mismatch - community captioners lean on taggers for that. For natural-language datasets and general-purpose image-to-text, it's exactly right.

There's also the version-naming snag that trips people up. The brief and the pack README call this node ImageCaptioningNode, but the class actually registered in ComfyUI is ImageCaptioning. Search for "LexTools" and grab the node labeled ImageCaptioning; if a workflow asks for the other name and it's not on the canvas, that's why.

Install

Install the pack once: ComfyUI Manager → search "ComfyUI-LexTools", or

cd ComfyUI/custom_nodes
git clone https://github.com/SOELexicon/ComfyUI-LexTools

then restart ComfyUI. The pack needs transformers (and torch, PIL, numpy - already present in ComfyUI). The BLIP weights download on first use, a few hundred MB. If you're in a hurry on a cold run, the first caption will stall while it fetches the model - that's normal, the second one is fast.

Troubleshooting

The most common failure is the first-run download failing or a stale transformers throwing an error mid-caption. Update the library - pip install -U transformers - and retry. And if you're batch-captioning hundreds of images for training, note that this node loads the model once and keeps it in memory, which is exactly what you want; on a small GPU, captioning is a slow trickle rather than a flood, so don't be surprised at the pace.

CategoryLexTools/ImageProcessing/Captioning

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (1)

NameTypeDescription
STRINGSTRING