Ollama OCR
Ollama OCR reads the text in images and PDF documents with an Ollama model that can see, either on your own Ollama server or on Ollama Cloud. It can enhance the image before reading it and follow your instructions about what to extract.
When to use it
- Reading scanned invoices or delivery notes to record their data.
- Getting the text from photos of documents that arrive on WhatsApp or by email.
- Extracting specific fields from a form, such as the name and the amount.
- You want to read documents with a model running on your own server.
Configuration
For Ollama Cloud you need an Ollama Cloud API credential; with your own server it is not needed. See Credentials.
| Field | What it does |
|---|---|
| Ollama Base URL (required) | Your Ollama server address or https://ollama.com (default) for Ollama Cloud. |
| Credential | The Ollama Cloud API credential. Only with Ollama Cloud. |
| Model Name | The vision model. Press the refresh button to see those available. |
| OCR Prompt (required) | What the model must do with the document. Default: “Read all the text in the image.”. You can ask, for example, for only certain fields. |
| Image/PDF Input | The image or PDF to read, for example the output of Binary or of a component that loads files. |
| Draw Bounding Boxes | If you ask in OCR Prompt for each text’s position, it also returns the image with the boxes drawn. Off by default. |
| Process PDF Pages | Reads each page of a PDF as a separate image. On by default. |
| Enhance Images | Enhances the image before reading it, only when needed. On by default and recommended. |
Advanced options
| Field | What it does |
|---|---|
| PDF DPI | Resolution used to convert PDF pages. Default: 300. |
| Gentle Contrast | Slightly raises the contrast of low-quality images. On by default. |
| Subtle Sharpen | Slightly sharpens the image. On by default. |
| Binarize (Black & White) | Turns the image into pure black and white. Off by default and not recommended. Binarize Threshold sets the threshold; 0 computes it automatically. |
| Max Tokens | Maximum length of the answer. Default: 4096. |
| Temperature | How creative the model is, from 0 to 1. Default: 0.1. |
Output
The OCR Results output holds the text read from each image or page.
In tool mode, an agent can use the component by itself. See Tool Mode.
Example
A municipal archive wants to digitise documents without sending them outside.
- Type its Ollama server address in Ollama Base URL and choose a vision model.
- Connect the documents to Image/PDF Input and save OCR Results.
Related components
- Text Extractor: pulls names, dates or amounts out of the text read.