```yaml
product: AlterLab
title: "OCR (Optical Character Recognition) — Web Scraping Glossary | AlterLab"
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
source_url: https://alterlab.io/glossary/ocr
```

extraction

# OCR (Optical Character Recognition)

OCR converts images containing text into machine-readable text, enabling scrapers to extract data from images, scanned PDFs, and canvas-rendered content.

Some web content deliberately obfuscates text by rendering it as an image, canvas element, or SVG path rather than HTML text — a technique used to prevent scraping or to embed contact details (phone numbers, email addresses) in a way that crawlers cannot read. OCR recovers this text by analysing the pixel patterns and recognising character shapes.

Tesseract is the most widely used open-source OCR engine, supporting over 100 languages. Cloud-based alternatives (Google Cloud Vision, AWS Textract, Azure Computer Vision) offer higher accuracy, especially for degraded or handwritten text. Modern multimodal LLMs (GPT-4o, Claude 3.5) can also extract text from images passed as base64-encoded inputs.

In scraping pipelines, OCR is applied selectively: first attempt to extract text directly from the DOM; only fall back to OCR for elements that yield no text content or that are detected as images. OCR is significantly slower and more resource-intensive than DOM-based extraction.

### What is OCR (Optical Character Recognition)?

OCR converts images containing text into machine-readable text, enabling scrapers to extract data from images, scanned PDFs, and canvas-rendered content.

### How does AlterLab handle OCR (Optical Character Recognition)?

In scraping pipelines, OCR is applied selectively: first attempt to extract text directly from the DOM; only fall back to OCR for elements that yield no text content or that are detected as images. OCR is significantly slower and more resource-intensive than DOM-based extraction.

## Examples

```
# Tesseract OCR on a screenshot of a page element
from PIL import Image
import pytesseract

# Capture screenshot with Playwright, save to file, then OCR
img = Image.open("element_screenshot.png")
text = pytesseract.image_to_string(img, config="--psm 6")
print(text)
```

## Related Terms

[Screenshot CaptureScreenshot capture renders a web page in a headless browser and saves the visual output as an image, useful for visual monitoring, archiving, or content that is difficult to parse as HTML.](https://alterlab.io/glossary/screenshot-capture)[PDF ExtractionPDF extraction involves parsing PDF files to retrieve structured text, tables, and metadata from documents served as downloadable files rather than HTML pages.](https://alterlab.io/glossary/pdf-extraction)[Data ExtractionThe process of identifying and pulling specific fields from raw web content, converting unstructured HTML into typed JSON records.](https://alterlab.io/glossary/data-extraction)[LLM (Large Language Model)A Large Language Model is a neural network trained on vast text corpora that can generate, summarise, translate, and reason over natural language at human level.](https://alterlab.io/glossary/llm)[Headless BrowserA web browser that runs without a graphical user interface, executing JavaScript and rendering pages exactly as a real browser would.](https://alterlab.io/glossary/headless-browser)

## Extract OCR (Optical Character Recognition) data from any website

AlterLab returns clean, structured data from any public URL — no scraper infrastructure needed. Start free, no credit card required.

[View API docs](https://alterlab.io/docs/api/rest)

[Back to Glossary](https://alterlab.io/glossary)