← 返回 Skills 市场
212
总下载
1
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install epub-eink-optimizer
功能描述
This skill should be used when the user wants to optimize an epub file for e-ink readers (墨水屏电子书). It handles image deduplication, removal of tiny decorative...
使用说明 (SKILL.md)
\r \r
epub 墨水屏优化技能\r
\r
目标\r
\r 将 epub 文件中的图片进行四步优化,大幅减小文件体积,同时保留在墨水屏设备上的可读性。\r \r
核心脚本\r
\r
scripts/optimize_epub.py — 一键运行全部优化步骤,支持单独开关每个步骤。\r
\r
# 全量优化(推荐默认用法)\r
python skills/epub-eink-optimizer/scripts/optimize_epub.py \x3Cepub路径>\r
\r
# 先分析,不修改文件\r
python skills/epub-eink-optimizer/scripts/optimize_epub.py \x3Cepub路径> --dry-run\r
\r
# 自定义参数示例\r
python skills/epub-eink-optimizer/scripts/optimize_epub.py \x3Cepub路径> \\r
--max-width 600 \\r
--quality 65 \\r
--min-size 20480\r
\r
# 只做某几步\r
python skills/epub-eink-optimizer/scripts/optimize_epub.py \x3Cepub路径> \\r
--no-dedup --no-clean-small\r
```\r
\r
**参数说明:**\r
\r
| 参数 | 默认值 | 说明 |\r
|------|--------|------|\r
| `--max-width` | 800 | 图片最大宽度(像素),超过则等比缩小 |\r
| `--quality` | 70 | JPEG 压缩质量(1-95),70 为画质与体积的平衡点 |\r
| `--min-size` | 10240 | 清除低于此字节数的图片(默认 10KB) |\r
| `--no-dedup` | — | 跳过重复图片合并 |\r
| `--no-resize` | — | 跳过宽度缩放 |\r
| `--no-recompress` | — | 跳过 JPEG 重压缩 |\r
| `--no-clean-small` | — | 跳过清小图 |\r
| `--dry-run` | — | 仅分析,不修改文件 |\r
\r
## 四步优化流程\r
\r
### 步骤 1:去重复图片\r
\r
同一张图片以不同文件名出现在多篇文章中(常见于转载同款配图、作者反复使用的插图)。\r
\r
- 用 MD5 哈希识别完全相同的图片\r
- 保留文件名排序靠前的一份,其余删除\r
- 自动更新所有 XHTML 中的引用和 OPF manifest\r
\r
### 步骤 2:清除小图\r
\r
微信公众号文章末尾通常插有固定的二维码、点赞、广告等装饰性小图(通常 \x3C 5KB),对阅读毫无价值。\r
\r
- 删除低于 `--min-size` 字节的图片文件\r
- 从 XHTML 中移除对应的 `\x3Cimg>` 标签\r
- 清理残留的空 `\x3Cp>` / `\x3Cdiv>` 标签\r
\r
### 步骤 3:缩放大图\r
\r
墨水屏设备分辨率通常为 1024-1448px 宽,超出无意义。\r
\r
- 将宽度超过 `--max-width` 的图片等比缩小\r
- JPEG 保存为 JPEG,PNG 保存为 PNG\r
- 中间使用 LANCZOS 高质量缩放算法\r
\r
### 步骤 4:JPEG 重压缩\r
\r
epub 中的 JPEG 原始质量往往是 85-95,对墨水屏来说过于精细。\r
\r
- 以 `--quality`(默认 70)重新压缩所有 JPEG\r
- 使用 `optimize=True` 开启哈夫曼表优化\r
- 通常可节省 15-25%\r
\r
## 典型效果参考\r
\r
| 场景 | 优化前 | 优化后 | 压缩率 |\r
|------|--------|--------|--------|\r
| 微信公众号合集(100篇+) | 70MB | 13MB | ~82% |\r
| 图文并茂博客(50篇) | 30MB | 8MB | ~73% |\r
| 纯文字为主(少量配图) | 5MB | 3MB | ~40% |\r
\r
## 手动处理补充指南\r
\r
脚本覆盖大多数场景,以下情况需要手动干预(参考 `references/manual-fixes.md`):\r
\r
- 图片为 base64 内嵌(非独立文件)\r
- epub 内部目录结构非标准(如多层嵌套)\r
- 需要将彩色图片转为灰度以进一步减体积\r
\r
## 依赖\r
\r
```bash\r
pip install Pillow\r
```\r
\r
Python 标准库:`zipfile`, `hashlib`, `re`, `io`, `os`\r
安全使用建议
This skill appears coherent and focused on EPUB image optimization. Before installing/running: 1) review and run the script with --dry-run first and always keep a backup of original EPUBs (the script writes changes in-place). 2) Confirm the script path referenced in SKILL.md matches the package layout. 3) Because the script uses simple basename replacements and regexes to update XHTML/OPF, test on a copy — in nonstandard EPUBs or with filenames that appear in text, replacements could be overzealous. 4) Ensure Pillow is installed in the runtime environment. 5) The provided file listing of optimize_epub.py in this review was truncated; if possible, inspect the full script locally to verify there are no unexpected network calls or extra behavior beyond what's shown. If you need higher assurance, ask the publisher for the full script and verify there are no network operations or hidden subprocess calls before running on sensitive content.
功能分析
Type: OpenClaw Skill
Name: epub-eink-optimizer
Version: 1.0.0
The skill bundle provides a legitimate utility for optimizing EPUB files for e-ink devices by deduplicating, resizing, and recompressing images. The core logic in `scripts/optimize_epub.py` uses standard Python libraries (Pillow, zipfile) to process files locally and contains no evidence of network activity, data exfiltration, or malicious execution patterns.
能力评估
Purpose & Capability
Name/description match the included code and docs: the Python script processes EPUB files and optimizes images. Declared dependency (Pillow) matches the code. No unrelated environment variables, binaries, or services are requested.
Instruction Scope
SKILL.md instructs running the included script and describes the four optimization steps implemented in scripts/optimize_epub.py. The instructions and script operate on EPUB content (XHTML, OPF, images) only and perform in-place modifications unless --dry-run is used. Two minor concerns: (1) SKILL.md examples use a path 'skills/epub-eink-optimizer/scripts/optimize_epub.py' which doesn't match the manifest path 'scripts/optimize_epub.py' — a path mismatch to verify; (2) the script performs text-based replacements and regex edits on XHTML/OPF (basename substitution and regex removal of <img> and <item> entries) which is brittle and could accidentally remove or alter other references if filenames collide with page text or if EPUB structure is non-standard. Use --dry-run and make backups.
Install Mechanism
No install spec; this is instruction + shipped Python scripts. The only required third-party dependency is Pillow (pip install Pillow), which is reasonable for image processing.
Credentials
No environment variables, credentials, or config paths are requested. The skill's actions are file-local (read/write the provided EPUB).
Persistence & Privilege
always is false; the skill is user-invocable and does not request permanent presence or modify other skills or system-wide settings.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install epub-eink-optimizer - 安装完成后,直接呼叫该 Skill 的名称或使用
/epub-eink-optimizer触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
epub-eink-optimizer 1.0.0
- Initial release: Optimize EPUB files for e-ink readers through a four-step process.
- Features automatic image deduplication, removal of small decorative images, resizing oversized images, and JPEG recompression.
- Command-line script with flexible parameter control for each optimization stage.
- Supports dry-run mode and manual adjustment of thresholds.
- Designed to significantly reduce file size while preserving readability on e-ink devices.
元数据
常见问题
epub-eink-optimizer 是什么?
This skill should be used when the user wants to optimize an epub file for e-ink readers (墨水屏电子书). It handles image deduplication, removal of tiny decorative... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 212 次。
如何安装 epub-eink-optimizer?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install epub-eink-optimizer」即可一键安装,无需额外配置。
epub-eink-optimizer 是免费的吗?
是的,epub-eink-optimizer 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
epub-eink-optimizer 支持哪些平台?
epub-eink-optimizer 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 epub-eink-optimizer?
由 wangkf(@wangkf)开发并维护,当前版本 v1.0.0。
推荐 Skills