Nodes/ComfyUI-Dashscope/Dashscope OCR Caller
ComfyUI Node

Dashscope OCR Caller

Read text out of any image, mid-workflow

By neverbiasu·Created 2 years ago·Updated 8 months ago· 6
Dashscope OCR Caller
  • image
  • STRING
model_versionqwen-vl-ocr
min_pixels28 * 28 * 4
max_pixels28 * 28 * 1280

Say you've got a screenshot, a scan, or a UI grab sitting in your workflow and you need the text out of it - not redrawn, not described, actually extracted. The Dashscope OCR Caller is the node for that. Feed it an image and it sends it to Alibaba's dedicated Qwen OCR model, which returns the text as a plain string you can route into an LLM, a save node, or a prompt.

The natural pairing: OCR the text, then hand it to DashscopeModelCaller to clean it up, translate it, or summarize it. That's the classic "read it, then think about it" pipeline, and it works well because DashScope runs both models on the same API key.

How it works

The node saves your image to ComfyUI's output folder and calls the Qwen-VL multimodal API with a hardcoded instruction: "Read all the text in the image." The model is qwen-vl-ocr, a Qwen-VL variant specialized for text extraction rather than general vision chat - which is why it's better at this than the general VLM models and cheaper to run. The reply comes back as a STRING of extracted text.

Two inputs look odd but you can mostly ignore them: min_pixels and max_pixels. These are Qwen-VL's image token-budget controls, written in its native expression form (defaults 28 * 28 * 4 and 28 * 28 * 1280 - 28×28 is the tile size, and the multipliers cap how many tiles the image is allowed to use). Higher max → the model sees more detail at the cost of speed and tokens. Leave the defaults until you hit a problem.

Inputs and output

  • model_version - three choices: qwen-vl-ocr (default), -latest, and the pinned 2024-10-28 snapshot. The bare alias is fine.
  • min_pixels / max_pixels - leave the defaults. Raise max_pixels if small or dense text keeps getting missed.
  • image (IMAGE) - the thing you want read.

Output is a single STRING with everything the model found. Note it's flat text in reading order, not structured - if you OCR a form or table you'll get a wall of lines, not columns, so that's where the ModelCaller cleanup step earns its keep.

Troubleshooting

  • "DASHSCOPE_API_KEY environment variable is not set" - the familiar one. The key is read from the environment at call time; set it before launching ComfyUI and restart. Mint one at the Bailian console (Alibaba Cloud Model Studio).
  • Missed or garbled text - bump max_pixels so the model gets more image resolution, and keep the source image reasonably sharp. Low-res screenshots are the usual culprit.
  • Region friction - getting the key is painless for existing Alibaba Cloud users, but some regions/models want mainland-China verification, which trips up first-timers. Budget a few minutes for sign-up.

Install

Part of the ComfyUI-Dashscope pack. In ComfyUI Manager, search ComfyUI-Dashscope, or:

cd ComfyUI/custom_nodes
git clone https://github.com/neverbiasu/ComfyUI-Dashscope
pip install -r requirements.txt

Restart and you're set. The only dependency is the dashscope pip package, there are no model files to download, and each OCR call bills against your Alibaba account - it's cheap per image, but it isn't free.

Categorydashscope

Inputs (4)

NameTypeDefaultDescription
model_versionCOMBOqwen-vl-ocr3 options: qwen-vl-ocr, qwen-vl-ocr-latest, qwen-vl-ocr-2024-10-28
min_pixelsSTRING28 * 28 * 4
max_pixelsSTRING28 * 28 * 1280
imageIMAGE

Outputs (1)

NameTypeDescription
STRINGSTRING