Skip to content

Extract text with OCR ​

Extract text from images and scanned documents with the OCR Extractor node.

When this is useful ​

Optical character recognition (OCR) turns text in images and scanned documents into data your workflow can process. Choose between RapidOCR models (local) and Mistral AI OCR models (API key needed).

Use OCR when you want to:

  • Digitize scanned invoices, receipts, or forms
  • Extract tables from documents that you only have as images or scans

Build an OCR workflow ​

Prerequisites

Before you start, make sure that you have:

  • configured credentials for Mistral AI, if you use a Mistral AI OCR model (see LLM Providers).

1. Select an OCR model ​

The selection of an OCR model depends on where the model runs.

RapidOCR models (no authentication required) ​

RapidOCR models are CPU-based OCR models that run in the workflow's execution environment. Use the Local OCR Model Selector node to select one. You don't need an account or API key, and your images aren't sent to an external OCR service. Choose RapidOCR when your documents must stay in your execution environment.

The Local OCR Model Selector node downloads the model at every node execution. To save execution time, save the downloaded model with a Model Writer node and read it with a Model Reader node. In this way, you can also use the model across multiple workflows without downloading it each time.

Mistral AI OCR models (authentication required) ​

Mistral AI OCR models run through the Mistral AI API. They offer higher-quality, layout-aware recognition and identify the type of each text block, such as title, header, or footer. You need a Mistral AI API key, and your files are sent to the Mistral AI API. Choose Mistral AI when documents can leave your execution environment.

  1. Provide your API key using a Credentials Configuration node or via secrets.
  2. Connect the credentials to the Mistral AI Authenticator node.
  3. Select an OCR model with the Mistral AI OCR Model Selector node.

2. Provide the documents ​

Read the documents in the workflow. Supported documents are images (PNG, JPEG, TIFF, BMP, GIF, ICO, and WebP) and PDF files.

Use the Read Images node for PNG images. For other file types, read them as binary objects with the Files to Binary Objects node.

3. Extract the text ​

Use the OCR Extractor node to extract the text from the provided documents.

Configure the node as follows:

  • Connect the model input port to the selected OCR model
  • Connect the data input port to the table containing the documents
  • Select the column that contains the images or documents

The node outputs one row per detected text block, with the extracted text, a confidence score, and the coordinates of the block's bounding box. Mistral AI models also return the block type.

4. Add bounding box ​

Use the OCR Overlayer node to draw a bounding box around the extracted text. Only PNG images are supported.

Next steps ​