Skip to main content

Yescan CLI - 夸克扫描王命令行工具

Project description

Yescan CLI

夸克扫描王命令行工具,支持 OCR 识别、图像增强、文档转换等功能。

环境要求

  • Python >= 3.8
  • pip

限制:单张图片大小 ≤ 5MB,支持格式:jpg / jpeg / png / gif / bmp / webp / tiff / tif

安装

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

# 列出所有配置(Key 类配置自动脱敏显示)
yescan config list

# 查看配置文件位置
yescan config path

# 删除配置
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

未指定的参数自动使用默认值,传入非法参数名或值会给出明确错误提示。

id-photo 场景共支持 4 个 --set 参数:background(背景色)、style_type(妆容风格)、style_fuse_level(妆容强度)、retouch(细节增强),完整参数表见 yescan --list-scenes id-photo

查看某场景支持的全部 --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

# 卸载 yescan
yescan uninstall

使用示例

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

yescan-1.0.5.tar.gz (26.4 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.5-py3-none-any.whl (28.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yescan-1.0.5.tar.gz
  • Upload date:
  • Size: 26.4 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.5.tar.gz
Algorithm Hash digest
SHA256 98cf3a2ab9df3075b6240fcc429717c835c502c87ee606b62df3a0544be4b4c1
MD5 7cf3e2395c6d874b9fde3701e5d20f2b
BLAKE2b-256 68547252c33c2d34d1ac9bc391b1924de30c6c3bb9765fa4b5848b13a83e4d16

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yescan-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 28.4 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e52b2b9eb559e3afb84e4ef423718e8dfbbbaedba62d1c0a80161fe0a7a5ab81
MD5 8fe9a4f570763bf14fded3e10125d946
BLAKE2b-256 5fc90aa9bd62d9b5ecdf906c559ea37280f6387c7b18b63208db2ccd21949e7e

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