Saltar al contenido
Skillpedia
PDF, Word y diapositivas9,5 mil · #12272

xberg-extracting-with-ocr

Qué hace

Esta habilidad muestra cómo sacar texto de documentos basados en imágenes usando OCR. Está pensada para personas con papeles escaneados, páginas fotografiadas o capturas de pantalla.

Cuándo usarla

  • ✓Cuando tienes un PDF escaneado o una foto de una página y necesitas el texto.
  • ✓Cuando un PDF sale vacío o con texto ilegible, aunque en pantalla se lee bien.
  • ✓Cuando necesitas el texto de un documento en otro idioma y debes fijar el idioma.

Link de la skill

https://github.com/xberg-io/xberg/blob/main/plugin/.ai-rulez/skills/xberg-extracting-with-ocr/SKILL.md

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/xberg-io/xberg/blob/main/plugin/.ai-rulez/skills/xberg-extracting-with-ocr/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“Saca el texto de este PDF escaneado de un contrato, que está escrito en español.”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

El agente activa el OCR, o lo fuerza en todas las páginas cuando la capa de texto es deficiente. Por defecto usa el motor integrado Tesseract y puede fijar el idioma de reconocimiento.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de GitHub.

Extracting with OCR

Use this when a document is image-based: scanned PDFs, photographed pages, screenshots, JPEG/PNG/TIFF with text. Xberg auto-OCRs raster images and auto-detects PDFs that lack a text layer. Force it on when extraction returned empty/garbled text from a PDF that "looks" textual.

When to force OCR

  • Extraction returned an empty content field, but the file opens visually.
  • The PDF text layer is junk (copy-paste from a viewer produces gibberish).
  • You want consistent output across mixed scanned + digital PDFs.
xberg extract scan.pdf --force-ocr=true
xberg extract scan.pdf --ocr=true --ocr-language eng

If a page has an unreliable text layer, --force-ocr=true re-rasterizes and runs OCR on every page.

Backends

Tesseract is the default and ships with the CLI — no extra install. Other backends are opt-in:

Backend Flag Install Notes
Tesseract --ocr-backend tesseract (default) bundled Best general-purpose, 100+ languages via tessdata.
PaddleOCR --ocr-backend paddle-ocr bundled (ONNX Runtime) Strong on Asian scripts. Not available on WASM or Windows.
Candle VLM --ocr-backend candle-trocr (and other candle-*) bundled (Candle) Local vision OCR models (candle-trocr, candle-paddleocr-vl, candle-glm-ocr, candle-deepseek-ocr).
VLM (hosted) --ocr-backend vlm + --vlm-model liter-llm provider (--vlm-api-key) Multimodal LLM via liter-llm. Use when OCR fails on dense or handwritten layouts.

Pick Tesseract first. Switch only when accuracy is unacceptable.

Language packs

Tesseract uses ISO 639-2 codes. Default is eng. Combine with +:

xberg extract menu.jpg --ocr=true --ocr-language "eng+deu"
xberg extract bilingual.pdf --ocr-language "eng+jpn"
xberg extract any.pdf --ocr-language all   # all installed packs

Install missing packs at the OS level:

# macOS
brew install tesseract-lang

# Debian/Ubuntu
sudo apt install tesseract-ocr-deu tesseract-ocr-jpn tesseract-ocr-fra

# Specific lang only
sudo apt install tesseract-ocr-<iso639-2>

Xberg fails fast with a helpful error if you request a language pack that is not installed. Read the error — it names the missing file.

Useful flags

  • --ocr=true — enable OCR (auto-enabled for images and scanned PDFs).
  • --force-ocr=true — OCR every page even if a text layer exists.
  • --disable-ocr=true — never OCR; use embedded text where available. Images and image-only pages can return metadata with no recognized text.
  • --ocr-language <lang> — single code or +-joined list, or all.
  • --ocr-backend <tesseract|paddle-ocr|vlm|candle-trocr|candle-paddleocr-vl|candle-glm-ocr|candle-deepseek-ocr> — pick backend.
  • --ocr-auto-rotate=true — pre-rotate via the auto-rotate model.
  • --acceleration <cpu|coreml|cuda|tensorrt|auto> — ONNX accelerator for paddle-ocr / auto-rotate / layout models.

Performance tips

  • Cache is on by default. Repeated extraction of the same file + config is instant. Do not pass --no-cache=true unless you have a reason.
  • For batch OCR, use xberg batch *.pdf --ocr=true — internal worker pool parallelizes across CPU cores. Cap with --max-concurrent N if memory is tight.
  • Raise --target-dpi (default 300) only for low-resolution scans. Higher DPI is slower; 200 is usually enough for printed text.
  • Enable --ocr-auto-rotate=true only when pages may be rotated; the classifier adds latency.
  • On Apple Silicon, --acceleration coreml typically beats CPU for paddle-ocr and layout detection.

Config file alternative

Long flag chains belong in xberg.toml — auto-discovered from cwd upward.

force_ocr = true
output_format = "markdown"

[ocr]
backend = "tesseract"
language = "eng+deu"
auto_rotate = true

Then just run:

xberg extract document.pdf

Common failure modes

  • "missing tessdata" — install the language pack at OS level (see above).
  • Empty content on a scanned PDF without --force-ocr — the file has a bog
Preguntas frecuentes

¿Necesita el OCR software adicional?

Tesseract viene incluido en la herramienta por defecto, así que el uso básico no requiere instalar nada más. Los demás motores OCR son opcionales.

¿Qué es forzar el OCR?

Significa que cada página se lee con OCR, incluso si la página ya tiene algo de texto incrustado.

¿Qué idiomas se admiten?

Tesseract admite más de 100 idiomas mediante archivos de datos de idioma.

Detalles

Descripción original del autor

Use when extracting text from scanned PDFs, photographed pages, or images that have no embedded text layer. Covers OCR backends, language packs, force-OCR, and performance tuning.

repo: xberg-io/xberg

Popularidad

Estrellas en GitHub
9,5 mil
Posición en el ranking
#12272
Licencia
MIT
Actualizada
2/11/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas