Skip to content

API Reference parrot_loaders.image

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_loaders.image

View source

ImageLoader: OCR-based image loader with layout-aware text extraction.

Orchestrates the full pipeline: open image → OCR → confidence filter → layout analysis → markdown → :class:Document.

Uses :func:asyncio.to_thread for all blocking OCR / model inference calls so it integrates safely with the async-first AI-Parrot framework.

Alias HeuristicLayoutAnalyzer

Re-exported from parrot_loaders.ocr.layout.HeuristicLayoutAnalyzer.

Class ImageLoader

OCR-based image loader with layout-aware text extraction.

Extracts text from images using an OCR backend (PaddleOCR, Tesseract, or EasyOCR) and structures the output with a layout analyser. The result is rendered as Markdown and wrapped in a :class:Document.

Parameter Type Default Description
source Optional[Union[str, Path, List[Union[str, Path]]]] None Path or list of paths to image files.
ocr_backend str 'auto' Backend identifier — "auto", "paddleocr", "tesseract", or "easyocr".
layout_model Optional[str] None Layout analyser to use. None (default) selects the heuristic analyser; "layoutlmv3" selects the transformer model.
language str 'en' ISO 639-1 language code for OCR.
detect_tables bool True Whether table detection is enabled (informational; the heuristic analyser always detects tables when possible).
detect_headers bool True Whether header detection is enabled (informational).
min_confidence float 0.5 Minimum OCR confidence threshold (0–1). Blocks below this value are discarded before layout analysis.
dpi int 300 Target DPI for image loading (informational; Pillow auto-detects).
tokenizer Union[str, Callable] None
text_splitter Union[str, Callable] None
**kwargs {} Additional keyword arguments forwarded to :class:AbstractLoader.

Attributes:

Attribute Type Description
extensions List[str] Supported file extensions.

Alias OCRBlock

Re-exported from parrot_loaders.ocr.models.OCRBlock.

Alias get_ocr_backend

Re-exported from parrot_loaders.ocr.get_ocr_backend.

Alias render_markdown

Re-exported from parrot_loaders.ocr.layout.render_markdown.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally