利用 Ollama 的视觉/OCR 模型从图像中识别文本。支持 glm-ocr、llava、moondream 及 llama3.2-vision 模型。适用于需要本地离线处理的场景。
Use this skill when you need to recognize text from images using Ollama's local vision/OCR models. No internet required - fully offline OCR.
ModelBest ForSizeglm-ocr:latestChinese text OCR2.2GB4.7GBllava:7bGeneral image understandingmoondreamLightweight vision model1.5GB7GB+llama3.2-vision:latestLarge vision model
Default: http://172.17.0.2:11434 (Docker container to host gateway)
Note: Endpoint is pre-configured for OpenClaw running in Docker accessing host Ollama. Adjust OLLAMA_HOST in ollama_ocr.py if your setup differs.
bash
python3 ollama_ocr.py /path/to/image.jpg [model_name]
Examples:
bash
python3 ollama_ocr.py receipt.png glm-ocr:latest
python3 ollama_ocr.py screenshot.jpg llava:7b
python
from ollama_ocr import ollama_ocr
# Basic OCR with default model (glm-ocr)
result = ollama_ocr('/path/to/image.jpg')
# Specify model
result = ollama_ocr('/path/to/image.jpg', 'glm-ocr:latest')
print(result)
glm-ocr works best for Chinese textollama pull glm-ocr:latest)