图像去水印
能力介绍
接入API
接入Agent
接入MCP
接入CLI
接入HermesAgent
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
# 查看配置
yescan config get
# 列出所有配置
yescan config list
# 删除配置
yescan config delete 其他命令
# 查看帮助
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