ocr-image-text-extract
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "ocr-image-text-extract" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-9763b28112d96e8b3ae44cd824eb9bd54e67d08942895523b0aafb97b18228e8. Verify the upstream source and version against https://skillhub.cn/skills/user_46180358/ocr-image-text-extract before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Use Tesseract OCR to extract text from images, combined with ImageMagick for preprocessing. Intended for OCR, recognition, or extracting text from images, screenshots, or photographed documents; supports Chinese (Simplified & Traditional) and English. Preprocessing steps—grayscale, contrast enhancement, sharpening, denoising, and 2x upscaling—significantly improve recognition accuracy on product pages, receipts, documents, and other real-world photos.
Introduction source: third_party · user_46180358 · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Extract text from images using Tesseract OCR with ImageMagick preprocessing. Use when asked to OCR, recognize, or extract text from an image, screenshot, or photo of a document. Handles Chinese (simplified + traditional) and English. The preprocessing step (grayscale + contrast + sharpen + despeckle + 2x upscale) significantly improves recognition accuracy for photos of product pages, receipts, documents, and other real-world images.
- Software, accounts and paid services
- Translation pending; see source documentation.
- Limits and differences
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: ocr-image-text-extract
description: Extract text from images using Tesseract OCR with ImageMagick preprocessing. Use when asked to OCR, recognize, or extract text from an image, screenshot, or photo of a document. Handles Chinese (simplified + traditional) and English. The preprocessing step (grayscale + contrast + sharpen + despeckle + 2x upscale) significantly improves recognition accuracy for photos of product pages, receipts, documents, and other real-world images.OCR Image Text Extract
Quick Usage
bash <skill>/scripts/preprocess_ocr.sh <image_path> [lang]
image_path: 任意图片格式(jpg/png/webp等)lang: 语言参数,默认chi_sim+chi_tra+eng(简体中文+繁体中文+英文)- 输出:识别后的纯文本到 stdout
预处理流程
ImageMagick 管道(顺序执行):
| 步骤 | 作用 |
|---|---|
-colorspace gray |
转灰度,消除颜色干扰 |
-level 20%,80%,1.5 |
增强对比度,压暗阴影,提亮高光 |
-sharpen 0x2 |
锐化,恢复模糊文字边缘 |
-despeckle |
去噪点,减少干扰 |
-resize 200% |
放大200%,Tesseract 对大图识别率更高 |
Tesseract 参数:
| 参数 | 值 | 作用 |
|---|---|---|
--oem 3 |
LSTM 神经网络引擎 | 最新、最高精度引擎 |
--psm 6 |
均匀文本块分割 | 适合商品页、文档等段落文本 |
环境依赖
- ImageMagick 7 (
magick命令) - Tesseract 5 (
tesseract命令)
安装命令(macOS):
# 安装核心组件
brew install imagemagick tesseract
# 附件语言包(中英文): https://github.com/tesseract-ocr/tessdata_fast
# 列出已安装的语言包
tesseract --list-langs
语言包(中英繁):
# 安装后下载精简语言包(放入用户目录,由 TESSDATA_PREFIX 指定)
mkdir -p ~/.tessdata
# 中文简体
curl -L "https://github.com/tesseract-ocr/tessdata_fast/raw/main/chi_sim.traineddata" \
-o ~/.tessdata/chi_sim.traineddata
# 中文繁体
curl -L "https://github.com/tesseract-ocr/tessdata_fast/raw/main/chi_tra.traineddata" \
-o ~/.tessdata/chi_tra.traineddata
示例
# 提取图片文字(默认简体中文+繁体中文+英文)
bash scripts/preprocess_ocr.sh ~/photo.jpg
# 指定语言
bash scripts/preprocess_ocr.sh ~/receipt.png eng
bash scripts/preprocess_ocr.sh ~/chinese_doc.jpg chi_sim
已知限制
- 竖排文字识别效果较差
- 艺术字体、手写体识别率低
- 图片过小(<200px宽)或严重压缩会明显影响效果
提示
如果MacOS系统太老,请提示用户使用MacPort代替Homebrew来安装组件
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 解决OCR文字提取的实际痛点,应用场景广泛
- 提供ImageMagick预处理流程显著提升识别准确率
- 支持中英文多语言识别
Highlights
- 触发词覆盖完整:OCR、recognize、extract text等
- 语言参数说明清晰,默认值合理
Areas to improve
-
缺少显式When to Use章节 Reported severity: Minor
已有description说明使用场景,但未设置显式章节
Recommendation: 建议增加显式When to Use章节提升可读性
Highlights
- 结构清晰,包含使用示例和参数说明
- 文档长度适中,信息完整
Areas to improve
-
缺少Windows/Linux安装说明 Reported severity: Minor
仅提供macOS安装命令,其他系统用户可能无法使用
Recommendation: 建议补充Linux和Windows系统的安装说明
-
缺少错误处理机制说明 Reported severity: Minor
未说明当ImageMagick或Tesseract未安装时的错误处理
Recommendation: 建议增加错误处理说明和常见问题排查
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 45 -
Invoke commands or scripts
Read the script and arguments first. Use ordinary privileges and a scoped directory; confirm installation or execution in your host tool.
Mentioned in main document · lines 72, 75, 76
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- github.com
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Translation pending; see source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.