Nodes/Comfyui_image2prompt/Image to Text 🐼
ComfyUI Node

Image to Text 🐼

Image to Text 🐼 — ComfyUI Node Guide

By zhongpei·Created 3 years ago·Updated about a year ago· 386
Image to Text 🐼
  • model
  • image
  • STRING
queryWhat is this?
custom_query
print_logfalse

What it is

Image to Text is the workhorse node in the Comfyui_image2prompt pack: point a vision-language model at an image, ask it a question, get a string back. That's it. That string is usually the thing you actually want out of the whole pipeline - a caption you can wire straight into a CLIP Text Encode node, or a description you paste somewhere else entirely.

This is an older-generation captioning approach compared to what the community mostly reaches for now (JoyCaption and Florence 2 have taken over training-set captioning), but as an in-workflow "describe this image" node it still does the job, and it's lighter than spinning up a full captioning pipeline for a one-off caption.

How it works

It doesn't load a model itself - that's the Loader Image to Text Model node's job. Image2Text just takes the loaded IMAGE2TEXT_MODEL, hands it your image plus a question, and returns whatever the model generates. Under the hood it's a straightforward vision-language model call: image in, text out, same shape as asking a chatbot "what's in this picture?" except it happens inside your graph.

Inputs and outputs

  • model - the IMAGE2TEXT_MODEL from Loader Image to Text Model. This is where you actually pick moondream, deepseek-vl, or whichever backbone you're running.
  • image - the image to describe.
  • query - a dropdown of four preset prompts, defaulting to "What is this?" The other three range from "Describe this photograph" to a genuinely enormous instruction that turns the model into an "AI image tagging expert" producing CLIP-friendly keyword tags (subject, style, composition, camera, the works) instead of a sentence.
  • custom_query - leave this blank to use the dropdown; fill it in and it overrides the preset entirely. This is where you'd put something narrower, like "describe only the clothing" if that's all you need.
  • print_log - dumps the output to the console too, handy while you're figuring out which model or query gives you what you want.

The single STRING output is a list, so if you batch multiple images through, you get a caption per image back out.

Installing it

Via ComfyUI Manager: search "Comfyui_image2prompt" and install. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/zhongpei/Comfyui_image2prompt

Restart ComfyUI. Note the README's own install snippet actually clones a hyphenated URL (Comfyui-image2prompt) that doesn't match the real repo - if you copy-paste it verbatim you'll hit a 404. Use the underscored URL above.

The models themselves aren't bundled. They download automatically the first time you run the node, pulled from Hugging Face into ComfyUI/models/image2text/. The README is upfront that this auto-download sometimes just doesn't happen, in which case you pull the model yourself with huggingface-cli download. If you're behind the Great Firewall, the README documents setting HF_ENDPOINT=https://hf-mirror.com before downloading - a nice detail that tells you who this pack was originally built for.

Common issues

First run is slow and network-heavy. These are real VLM checkpoints, some of them (internlm-xcomposer2-vl-7b, deepseek-vl-7b-chat) multi-gigabyte 7B models. Don't panic if the first execution takes several minutes - it's downloading, not hanging. Check your terminal log if you're unsure.

Missing-node and dependency conflicts. This pack pulls in several separate VLM libraries with their own transformers version requirements, all installed into the same Python environment ComfyUI uses. If you've got a lot of other custom nodes installed already, a version conflict here isn't unusual - it's the generic ComfyUI custom-node tax, not specific to this pack, but it's worth knowing where to look first if things error out on load rather than at generation time.

Workflow JSONs from the README not loading cleanly. At least one user reported the example workflow from this pack not opening - worth checking that your installed node names actually match what the JSON expects before assuming something's broken; ComfyUI Manager's "Install Missing Custom Nodes" on a freshly-loaded workflow is the fastest way to confirm.

For the model choice itself, pair this node's write-up with the Loader Image to Text Model article - that's where the moondream1-vs-moondream2 tradeoffs actually live.

Categoryfofo🐼/image2prompt

Inputs (5)

NameTypeDefaultDescription
modelIMAGE2TEXT_MODEL
imageIMAGE
queryCOMBOWhat is this?4 options: Describe this photograph., What is this?, Please describe this image in detail., As an AI image tagging expert, please provide precise tags for these images to enhance CLIP model's understanding of the content. Employ succinct keywords or phrases, steering clear of elaborate sentences and extraneous conjunctions. Prioritize the tags by relevance. Your tags should capture key elements such as the main subject, setting, artistic style, composition, image quality, color tone, filter, and camera specifications, and any other tags crucial for the image. When tagging photos of people, include specific details like gender, nationality, attire, actions, pose, expressions, accessories, makeup, composition type, age, etc. For other image categories, apply appropriate and common descriptive tags as well. Recognize and tag any celebrities, well-known landmark or IPs if clearly featured in the image. Your tags should be accurate, non-duplicative, and within a 20-75 word count range.
custom_querySTRING
print_logBOOLEANfalse

Outputs (1)

NameTypeDescription
STRINGSTRING