OCR
1. Overview
The OCR component (ocr) extracts text from an image using optical character recognition (OCR). It's useful for reading scanned documents, receipt photos, screenshots with text, and more.
Use it when the flow needs to turn an image into searchable text. Not suited for PDFs with native text (in that case, the PDF Reader component is more appropriate, since it reads the text directly without needing OCR).
2. Prerequisites
No external credentials — text recognition runs locally (Tesseract engine), with no calls to external services.
3. Authentication and Connection
Not applicable.
4. Configuration / Supported Operations
The component has a single operation: extract text from an image.
| Field | Required | Type | Description | Example |
|---|---|---|---|---|
image | Yes | Text | Name of the message property where the image is. | "receipt" |
format | No | Text: text or markdown | Format of the extracted text. markdown adds Markdown-compatible line breaks. Default value: "text". | "markdown" |
language | No | Text | Language code of the text in the image. Default value: "eng" (English). | "por" (Portuguese) |
dpi | No | Number | Resolution (DPI) provided to the OCR engine. Default value: 300. | 300 |
pageSegMode | No | Number | OCR engine's page segmentation mode (controls how text is identified in the image layout). Default value: 6. | 6 |
blockSize | No | Number | Technical parameter for image pre-processing (binarization). Default value: 15. | 15 |
thresholdOffset | No | Number | Technical parameter for image pre-processing (binarization). Default value: 10. | 10 |
⚠️ TO CONFIRM:
pageSegModevalues follow Tesseract's standard numbering (e.g.,6= "uniform block of text"), but the code doesn't document the complete table of possible values.
5. Practical Examples
Simple example: extract the text from a payment receipt image, received in Portuguese.
Input (image already attached by a previous step, e.g. an upload):
{
"receipt": "<image file, made available by a previous step>"
}
Component configuration:
{
"componentName": "ocr",
"configurations": {
"image": "receipt",
"language": "por"
}
}
Response:
{
"text": "PAYMENT RECEIPT\nAmount: R$ 150.00\nDate: 07/20/2026",
"format": "text",
"language": "por",
"length": 52
}
Advanced example: extract text from an image already targeting Markdown format (to display preserving line breaks), adjusting pre-processing parameters for a low-quality image.
Component configuration:
{
"componentName": "ocr",
"configurations": {
"image": "documentPhoto",
"language": "por",
"format": "markdown",
"blockSize": "25",
"thresholdOffset": "15"
}
}
Response:
{
"text": "ID DOCUMENT \nName: Maria Silva \nTax ID: 123.456.789-00",
"format": "markdown",
"language": "por",
"length": 59
}
6. Common Errors and Troubleshooting
| Error / Symptom | Likely Cause | How to Fix |
|---|---|---|
| "An image file is required but has not been configured." | The image field wasn't filled in. | Fill in image with the name of the property that contains the image. |
| "File [name] not found inside the execution context." | The referenced image isn't available in the message under that name. | Confirm a previous step made the image available under that exact name. |
| "Unsupported or corrupted image format" | The submitted file isn't a valid image, or is corrupted. | Check whether the file is really an image in a supported format (e.g., JPG, PNG). |
| "OCR processing failed: ..." | Internal OCR engine failure processing the image. | Try with a higher quality/resolution image, or review the pre-processing parameters. |
| Extracted text has a lot of errors/noise | Low-quality image, incorrectly configured language, or pre-processing parameters unsuited to the image type. | Adjust language to the text's correct language and test different blockSize/thresholdOffset values. |