ComfyUI Node

Apply DotsOCR

Text extraction that actually reads the image

By yolain·Created 11 months ago·Updated 11 months ago· 6
Apply DotsOCR
  • dots_ocr_model
  • image
  • result
prompt_templateprompt_ocr
unload_modelfalse
temperature0.10
seed0
custom_prompt

What it is and why you'd reach for it

Apply DotsOCR is the payoff node of yolain's ComfyUI-Easy-DotsOCR pack. You feed it the model handle from DotsOCR Model Loader plus an image, and it returns the text it found as a plain string. Screenshot, scanned page, whiteboard photo, a UI mockup you want to caption - if the next step in your workflow needs the words in an image, this is the node.

Here's the thing: ComfyUI's OCR options have always been thin. Most people end up shelling out to a Python node or an external script. DotsOCR is a proper vision-language model trained for document reading - it handles messy layouts and can even return structured layout data, not just a blob of text. And because it's a local model, there's no API key and no per-page cost. The name is honest: "apply" is what it does.

How it works

The node takes the IMAGE tensor, converts it to a PIL image, and builds a chat message: the picture plus the prompt from your selected template. That message goes through the Qwen2.5-VL processor's chat template into the model, which generates up to 2048 tokens (at your temperature and seed, with top-p fixed at 0.9), and the result is decoded and returned as one string. Nothing leaves your machine.

The inputs that matter

Only two are essential, and the first one isn't even in this node:

  • dots_ocr_model: the handle from DotsOCR Model Loader. If you've never run the loader, this is the error you'll get. Run it first - the first load downloads ~6 GB, so budget for it.
  • image: the IMAGE you want read.

Then the ones worth knowing about:

  • prompt_template (default prompt_ocr): a dropdown of four built-in templates. prompt_ocr is the plain "extract the text." prompt_grounding_ocr targets a specific bounding box. prompt_layout_only_en returns JSON of layout regions (bbox + category like Title, Table, Formula), and prompt_layout_all_en returns the full structured layout with text rendered as Markdown, LaTeX, or HTML depending on element type.
  • custom_prompt (optional): overrides the template entirely, per the author's tooltip. This is your escape hatch - and it's also how you actually do grounded OCR, since the built-in grounding template ships with an empty bounding box that you supply yourself here.
  • unload_model: on means the model gets dropped from VRAM after inference. Leave it off if you're chaining OCR reads; flip it on when you OCR once and then go back to image generation, because a ~6 GB VLM sitting in VRAM will make your sampler sad.
  • temperature (0.1–2, default 0.1) and seed: the usual knobs. Lower temperature means more literal transcription; if a scan is noisy or ambiguous, nudging it up can help - at the cost of the occasional hallucinated word.

The output

result is a STRING - the extracted text. Wire it into any text display or save node (ShowText or similar) to see it, or into a text-processing or LLM node downstream. One warning: the layout templates emit JSON as a string, so if you pick those, run the output through a JSON formatter before you eyeball it.

Gotchas

Same pack install as the loader: ComfyUI Manager (search ComfyUI-Easy-DotsOCR), or clone the repo into custom_nodes, pip install -r requirements.txt, restart. It needs recent transformers (>=4.51.3) and a current ComfyUI for the extension API.

Two real traps from the source:

  • Only the first frame of a batch is read. The image conversion uses batch index 0, so feeding it a batch of images means the rest are silently ignored. If you have several images to OCR, run them one at a time - or loop the node per image.
  • unload_model costs you a reload. It's not just "free memory"; the node invalidates the loaded model so the loader has to re-load it next time. Still from disk, no re-download, but it's not instant.
CategoryEasyUse/DotsOCR

Inputs (7)

NameTypeDefaultDescription
dots_ocr_modelEASY_DOTSOCR_MODEL
imageIMAGE
prompt_templateCOMBOprompt_ocrprompt to guide the OCR process
unload_modelBOOLEANfalseUnload model from VRAM after inference
temperatureFLOAT0.100.1–2
seedINT00–4294967295
custom_promptoptSTRINGCustom prompt template (optional, will override template if provided)

Outputs (1)

NameTypeDescription
resultSTRINGoutput the result