Skip to main content

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/ 保存文档到指定目录

输出格式(指定 --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

使用示例

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/

可用场景

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 医疗报告识别
product-image-ocr 商品包装识别

图像增强类

场景名 说明
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

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

yescan-1.0.2.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yescan-1.0.2-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file yescan-1.0.2.tar.gz.

File metadata

  • Download URL: yescan-1.0.2.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for yescan-1.0.2.tar.gz
Algorithm Hash digest
SHA256 4c96b3a001622ea31cc38695d527ba37161ef1544cabb042be3e22ebd406b654
MD5 0f0ab021718685c971662622d90da939
BLAKE2b-256 dd1793f31b8bb859bf009c525e83f2b2688ff3a2d8afbe464018feb6777be153

See more details on using hashes here.

File details

Details for the file yescan-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: yescan-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for yescan-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 01084d007b505d5b3cec4dc88cc0fe3a7cf9c4c469da1420c19244a8f116d538
MD5 285cb8b80cdfd825bd77ca4bb43a0cc5
BLAKE2b-256 a3c33744f09e966ea566522b992c139041f22814a6e02f1b388ccaa9bd2a9c94

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page