Yescan CLI - 夸克扫描王命令行工具
Project description
Yescan CLI
夸克扫描王命令行工具,支持 OCR 识别、图像增强、文档转换等功能。
环境要求
- Python >= 3.8
- pip
安装
pip install yescan
如遇权限问题,可使用用户级安装:
pip install yescan --user
安装完成后,yescan 命令即可全局使用。
升级
pip install yescan --upgrade
卸载
pip uninstall yescan
配置
yescan config set SCAN_WEBSERVICE_KEY your-api-key
获取 API Key:https://scan.quark.cn/business → 开发者后台 → 登录/注册 → 查看 API Key
配置文件保存在 ~/.yescan/config.json。
其他配置命令:
# 查看配置
yescan config get SCAN_WEBSERVICE_KEY
# 列出所有配置
yescan config list
# 删除配置
yescan config delete SCAN_WEBSERVICE_KEY
也支持环境变量方式:
export SCAN_WEBSERVICE_KEY="your-api-key"
命令参考
OCR 识别
# 基本格式
yescan --scene <场景名> --path <本地图片路径>
yescan --scene <场景名> --url <图片URL>
# 简写
yescan -s <场景名> -p <图片路径>
yescan -s <场景名> -u <图片URL>
# 指定输出目录(保存结果文件)
yescan -s <场景名> -p <图片路径> -o <输出目录>
yescan -s <场景名> -p <图片路径> --output <输出目录>
注意:使用
--url/-u参数时,URL 建议用单引号包裹(如-u 'https://...'),避免 shell 对特殊字符(如!$等)进行解析。
--output/-o 参数说明
| 场景类型 | 不指定 --output | 指定 --output |
|---|---|---|
| OCR 识别类 | 直接打印 JSON 结果 | 保存 JSON 到指定目录 |
| 图像增强类 | 保存图片到 /tmp/imgs/ | 保存图片到指定目录 |
| 文档转换类 | 保存文档到 /tmp/documents/ | 保存文档到指定目录 |
| AIGC 生成类 | 保存图片到 /tmp/imgs/ | 保存图片到指定目录 |
| 图片翻译 | 保存翻译图到 /tmp/imgs/ + 打印译文 JSON | 保存翻译图+JSON 到指定目录 |
--set 参数说明
用于传递场景特有参数(如 AIGC 类场景),支持两种写法:
# 逗号合并(推荐)
yescan -s id-photo -p ./photo.jpg --set background=red,style_type=baibi
# 多次 --set
yescan -s id-photo -p ./photo.jpg --set background=red --set style_type=baibi
未指定的参数自动使用默认值,传入非法参数名或值会给出明确错误提示。
查看某场景支持的全部
--set参数(含默认值、可选值、示例):yescan --list-scenes <场景名>
输出格式(指定 --output 时):
{"code": 0, "msg": "success", "data": {"path": "/absolute/path/to/file"}}
配置管理
# 设置配置
yescan config set <KEY> <VALUE>
# 查看配置
yescan config get <KEY>
# 列出所有配置
yescan config list
# 删除配置
yescan config delete <KEY>
其他命令
# 查看帮助
yescan --help
yescan -h
# 查看版本
yescan --version
yescan -v
# 列出所有可用场景
yescan --list-scenes
# 查看单个场景的 --set 参数表(默认值/可选值/示例)
yescan --list-scenes id-photo
使用示例
OCR 识别类
# 身份证识别(直接打印 JSON)
yescan -s idcard-ocr -p ./idcard.jpg
# 通用 OCR(URL 输入)
yescan -s general-ocr -u 'https://example.com/doc.jpg'
# 表格识别(保存 JSON 到指定目录)
yescan -s table-ocr -p ./table.png -o ./results/
图像增强类
# 去除水印(保存到默认目录 /tmp/imgs/)
yescan -s remove-watermark -p ./image.png
# 去除水印(保存到指定目录)
yescan -s remove-watermark -p ./image.png -o ./output/
# 试卷增强
yescan -s exam-enhance -u 'https://example.com/exam.jpg' -o ./enhanced/
文档转换类
# 图片转 Word(保存到默认目录 /tmp/documents/)
yescan -s image-to-word -p ./doc.jpg
# 图片转 Excel(保存到指定目录)
yescan -s image-to-excel -p ./table.png -o ./docs/
# 图片转 PDF
yescan -s image-to-pdf -p ./doc.jpg -o ./docs/
AIGC 生成类
# 证件照(默认参数:白底、强修容)
yescan -s id-photo -p ./photo.jpg
# 证件照(自定义参数)
yescan -s id-photo -p ./photo.jpg --set background=blue,style_type=baibi
# 查看该场景支持的全部参数(默认值/可选值/示例):
yescan --list-scenes id-photo
图片翻译
# 翻译图片(输出翻译图片路径 + 逐行译文坐标 JSON)
yescan -s pic-translate -p ./english_doc.jpg
# 指定输出目录(翻译图片 + JSON 都保存到该目录)
yescan -s pic-translate -p ./menu.jpg -o ./translated/
pic-translate同时返回翻译后的渲染图片和结构化译文数据(含坐标), CLI 自动保存图片并在 JSON 中注入translated_image_path字段。
可用场景
OCR 识别类
| 场景名 | 说明 |
|---|---|
general-ocr |
通用文字识别 |
handwritten-ocr |
手写文字识别 |
table-ocr |
表格识别 |
idcard-ocr |
身份证识别 |
driver-license-ocr |
驾驶证识别 |
vehicle-license-ocr |
行驶证识别 |
vat-invoice-ocr |
增值税发票识别 |
train-ticket-ocr |
火车票识别 |
business-license-ocr |
营业执照识别 |
degree-certificate-ocr |
学位证识别 |
formula-ocr |
公式识别 |
question-ocr |
题目识别 |
social-security-card-ocr |
社保卡识别 |
travel-permit-ocr |
通行证识别 |
commercial-invoice-ocr |
商业发票识别 |
medical-report-ocr |
医疗报告识别 |
pharmaceutical-inspection-report |
药品报告单识别 |
product-image-ocr |
商品包装识别 |
pic-translate |
外文图片翻译 |
图像增强类
| 场景名 | 说明 |
|---|---|
exam-enhance |
试卷增强 |
image-hd-enhance |
高清增强 |
certificate-enhance |
证件增强 |
remove-handwriting |
去除手写 |
remove-watermark |
去除水印 |
remove-shadow |
去除阴影 |
remove-screen-pattern |
去除摩尔纹 |
remove-background-color |
去除背景色 |
image-crop-rectify |
裁切矫正 |
sketch-drawing |
素描风格 |
extract-lineart |
提取线稿 |
scan-document |
文档扫描 |
scan-contract |
合同高清 |
文档转换类
| 场景名 | 说明 |
|---|---|
image-to-word |
图片转 Word |
image-to-excel |
图片转 Excel |
image-to-pdf |
图片转 PDF |
AIGC 生成类
| 场景名 | 说明 |
|---|---|
id-photo |
证件照 |
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yescan-1.0.4.tar.gz.
File metadata
- Download URL: yescan-1.0.4.tar.gz
- Upload date:
- Size: 24.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7854b70106db0f04e70dc6bd981c8d54bdc864aa190193d0ae48d4827688607a
|
|
| MD5 |
bc22a05f2f666428fdaab8298584f764
|
|
| BLAKE2b-256 |
4428a6b6fec0c1e74b4df5a7e8d4a9178f6dd6e280a9e323825de45c875b9b7b
|
File details
Details for the file yescan-1.0.4-py3-none-any.whl.
File metadata
- Download URL: yescan-1.0.4-py3-none-any.whl
- Upload date:
- Size: 26.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5275846976c31f21473a0fd15e943e8f02116be664141bdddd904a06ccc2abd8
|
|
| MD5 |
067cc3237127373f981470c133bbd050
|
|
| BLAKE2b-256 |
19a59ed4f275f7f32479593971d61803ef89becb4fe3745686260b4d56dfd333
|