OCR.space icon

OCR.space

Extract text from images using OCR.space API

Overview

This node integrates with the OCR.space API to extract text from images using Optical Character Recognition (OCR). It processes binary image data provided as input and returns the recognized text along with detailed OCR metadata. This node is useful for automating text extraction from scanned documents, receipts, photographs of text, or any image containing textual information.

Common scenarios include:

  • Digitizing printed documents for searchable archives.
  • Extracting text from invoices or receipts for accounting automation.
  • Reading text from screenshots or photos for data entry automation.
  • Processing structured documents like tables or forms with enhanced accuracy.

Properties

Name Meaning
Binary Property Name of the binary property that contains the image file to be processed by OCR.
Language Language to use for OCR text recognition. Options include: Auto-detect (Engine 2 only), Arabic, Bulgarian, Chinese (Simplified), Chinese (Traditional), Croatian, Czech, Danish, Dutch, English, Finnish, French, German, Greek, Hungarian, Italian, Japanese, Korean, Polish, Portuguese, Russian, Slovenian, Spanish, Swedish, Turkish.
OCR Engine OCR engine version to use for text extraction. Options: Engine 1 (default), Engine 2 (alternative engine better suited for certain image types).
Additional Options Collection of optional settings:
• Detect Orientation: Automatically detect and correct image orientation.
• Get Word Coordinates: Return word-level bounding box coordinates.
• Scale Image: Scale the image to improve OCR accuracy.
• Table Mode: Optimize OCR for tables, receipts, and structured documents with line-by-line parsing.

Output

The node outputs an array of items where each item contains:

  • json:
    • Original input JSON merged with:
      • extractedText: The full text extracted from the image.
      • ocrResults: An object containing:
        • fullResponse: The complete raw response from the OCR.space API.
        • processingTimeInMilliseconds: Time taken by the OCR process.
        • textOrientation: Detected orientation of the text in the image.
        • fileParseExitCode: Status code indicating success or failure of file parsing.
      • If "Get Word Coordinates" option is enabled and available, a wordCoordinates field containing word-level bounding box data.
  • binary: The original binary data passed through unchanged.
  • pairedItem: Metadata linking output to the input item index.

If the node encounters errors and "Continue On Fail" is enabled, it outputs an item with an error field describing the issue.

Dependencies

  • Requires an active API key credential for the OCR.space service.
  • Uses the OCR.space REST API endpoint at https://api.ocr.space/parse/image.
  • Requires n8n credentials configuration to securely store and access the OCR.space API key.
  • Utilizes the form-data package internally to send multipart form data requests.

Troubleshooting

  • No binary data found: Ensure the specified binary property name matches the actual binary data property in the input. The node throws an error if the image data is missing.
  • OCR API errors: Errors returned by the OCR.space API are surfaced with messages from the API. Common causes include invalid API keys, unsupported file formats, or exceeding usage limits.
  • Incorrect language setting: Selecting a language not supported by the chosen OCR engine may cause inaccurate results or errors. Use "Auto-detect" only with Engine 2.
  • Image quality issues: Low-resolution or skewed images may reduce OCR accuracy. Enable options like "Detect Orientation" or "Scale Image" to improve results.
  • Word coordinates missing: If "Get Word Coordinates" is enabled but no overlay data is returned, verify the input image and OCR engine compatibility.

Links and References

Discussion