xberg-extracting-with-ocr
O que ela faz
Esta skill mostra como obter texto de documentos baseados em imagem usando OCR. É para quem tem papelada digitalizada, páginas fotografadas ou capturas de tela.
Quando usar
- ✓Quando você tem um PDF digitalizado ou uma foto de página e precisa do texto.
- ✓Quando um PDF sai vazio ou com caracteres embaralhados, mas parece legível na tela.
- ✓Quando precisa do texto de um documento em outro idioma e precisa definir o idioma.
Link da skill
https://github.com/xberg-io/xberg/blob/main/plugin/.ai-rulez/skills/xberg-extracting-with-ocr/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Extraia o texto deste PDF digitalizado de contrato, que está escrito em espanhol.”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
O agente ativa o OCR, ou o força em todas as páginas quando a camada de texto é ruim. Por padrão usa o motor Tesseract embutido e pode definir o idioma usado no reconhecimento.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do 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
contentfield, 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, orall.--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=trueunless you have a reason. - For batch OCR, use
xberg batch *.pdf --ocr=true— internal worker pool parallelizes across CPU cores. Cap with--max-concurrent Nif 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=trueonly when pages may be rotated; the classifier adds latency. - On Apple Silicon,
--acceleration coremltypically 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
Perguntas frequentes
O OCR precisa de software extra?
O Tesseract vem com a ferramenta por padrão, então o uso básico não exige instalação extra. Outros motores de OCR são opcionais.
O que é forçar OCR?
Significa que cada página é lida com OCR, mesmo que ela tenha algum texto embutido.
Quais idiomas são suportados?
O Tesseract suporta mais de 100 idiomas, por meio de arquivos de dados de idioma.
Detalhes
Descrição original do 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
Popularidade
- Estrelas no GitHub
- 9,5 mil
- Posição no ranking
- #12272
- Licença
- MIT
- Atualizada em
- 02/11/2026
Comentários
- …
Mais skills deste repositório
xberg-batch-extraction
9,5 milAjuda seu agente a processar muitos documentos de uma vez com o Xberg, usando opções compartilhadas e sem parar tudo por causa de um arquivo com erro.
xberg-chunking
9,5 milAjuda seu agente a dividir textos longos de documentos em pedaços menores para prompts de IA ou índices de busca, com tamanhos definidos e sobreposição opcional.
xberg-extracting-keywords
9,5 milAjuda seu agente a extrair as principais palavras-chave ou expressões de um documento e a detectar o idioma dele, usando as configurações de palavras-chave do Xberg.
xberg-extracting-tables
9,5 milAjuda seu agente a extrair tabelas de PDFs, planilhas e imagens, mantendo linhas e colunas íntegras em markdown ou em dados estruturados.
Skills parecidas
feishu-doc
394 milAjuda seu agente a ler, criar e editar documentos na nuvem do Feishu, incluindo textos, imagens e tabelas, usando a ferramenta de documentos.
feishu-drive
394 milPermite que seu agente navegue, organize e comente arquivos de uma pasta na nuvem do Feishu que foi compartilhada com o bot.
feishu-perm
394 milAjuda seu agente a verificar e alterar quem pode acessar um arquivo do Feishu, escolhendo a menor permissão que atende ao seu pedido.