tuzi-compress-image by tuziapi/tuzi-skills
npx skills add https://github.com/tuziapi/tuzi-skills --skill tuzi-compress-image使用最佳可用工具压缩图像(sips → cwebp → ImageMagick → Sharp)。
脚本位于 scripts/ 子目录中。请将 ${SKILL_DIR} 替换为此 SKILL.md 文件的目录路径。
| 脚本 | 用途 |
|---|---|
scripts/main.ts | 图像压缩命令行工具 |
使用 Bash 检查 EXTEND.md 是否存在(优先级顺序):
# 首先检查项目级别
test -f .tuzi-skills/tuzi-compress-image/EXTEND.md && echo "project"
# 然后检查用户级别(跨平台:$HOME 在 macOS/Linux/WSL 上均适用)
test -f "$HOME/.tuzi-skills/tuzi-compress-image/EXTEND.md" && echo "user"
┌────────────────────────────────────────────────────────┬───────────────────┐ │ 路径 │ 位置 │ ├────────────────────────────────────────────────────────┼───────────────────┤ │ .tuzi-skills/tuzi-compress-image/EXTEND.md │ 项目目录 │ ├────────────────────────────────────────────────────────┼───────────────────┤ │ $HOME/.tuzi-skills/tuzi-compress-image/EXTEND.md │ 用户主目录 │ └────────────────────────────────────────────────────────┴───────────────────┘
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
┌───────────┬───────────────────────────────────────────────────────────────────────────┐ │ 结果 │ 操作 │ ├───────────┼───────────────────────────────────────────────────────────────────────────┤ │ 找到 │ 读取、解析、应用设置 │ ├───────────┼───────────────────────────────────────────────────────────────────────────┤ │ 未找到 │ 使用默认值 │ └───────────┴───────────────────────────────────────────────────────────────────────────┘
EXTEND.md 支持 : 默认格式 | 默认质量 | 保留原始文件偏好
npx -y bun ${SKILL_DIR}/scripts/main.ts <input> [options]
| 选项 | 简写 | 描述 | 默认值 |
|---|---|---|---|
<input> | 文件或目录 | 必需 | |
--output | -o | 输出路径 | 相同路径,新扩展名 |
--format | -f | webp, png, jpeg | webp |
--quality | -q | 质量 0-100 | 80 |
--keep | -k | 保留原始文件 | false |
--recursive | -r | 处理子目录 | false |
--json | JSON 输出 | false |
# 单个文件 → WebP(替换原始文件)
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png
# 保持 PNG 格式
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png -f png --keep
# 目录递归处理
npx -y bun ${SKILL_DIR}/scripts/main.ts ./images/ -r -q 75
# JSON 输出
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png --json
输出 :
image.png → image.webp (245KB → 89KB, 64% 压缩率)
通过 EXTEND.md 进行自定义配置。有关路径和受支持的选项,请参阅 偏好设置 部分。
每周安装量
74
代码仓库
GitHub 星标数
24
首次出现
2026年3月5日
安全审计
安装于
openclaw58
opencode45
gemini-cli45
github-copilot45
amp45
cline45
Compresses images using best available tool (sips → cwebp → ImageMagick → Sharp).
Scripts in scripts/ subdirectory. Replace ${SKILL_DIR} with this SKILL.md's directory path.
| Script | Purpose |
|---|---|
scripts/main.ts | Image compression CLI |
Use Bash to check EXTEND.md existence (priority order):
# Check project-level first
test -f .tuzi-skills/tuzi-compress-image/EXTEND.md && echo "project"
# Then user-level (cross-platform: $HOME works on macOS/Linux/WSL)
test -f "$HOME/.tuzi-skills/tuzi-compress-image/EXTEND.md" && echo "user"
┌────────────────────────────────────────────────────────┬───────────────────┐ │ Path │ Location │ ├────────────────────────────────────────────────────────┼───────────────────┤ │ .tuzi-skills/tuzi-compress-image/EXTEND.md │ Project directory │ ├────────────────────────────────────────────────────────┼───────────────────┤ │ $HOME/.tuzi-skills/tuzi-compress-image/EXTEND.md │ User home │ └────────────────────────────────────────────────────────┴───────────────────┘
┌───────────┬───────────────────────────────────────────────────────────────────────────┐ │ Result │ Action │ ├───────────┼───────────────────────────────────────────────────────────────────────────┤ │ Found │ Read, parse, apply settings │ ├───────────┼───────────────────────────────────────────────────────────────────────────┤ │ Not found │ Use defaults │ └───────────┴───────────────────────────────────────────────────────────────────────────┘
EXTEND.md Supports : Default format | Default quality | Keep original preference
npx -y bun ${SKILL_DIR}/scripts/main.ts <input> [options]
| Option | Short | Description | Default |
|---|---|---|---|
<input> | File or directory | Required | |
--output | -o | Output path | Same path, new ext |
--format | -f | webp, png, jpeg | webp |
--quality |
# Single file → WebP (replaces original)
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png
# Keep PNG format
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png -f png --keep
# Directory recursive
npx -y bun ${SKILL_DIR}/scripts/main.ts ./images/ -r -q 75
# JSON output
npx -y bun ${SKILL_DIR}/scripts/main.ts image.png --json
Output :
image.png → image.webp (245KB → 89KB, 64% reduction)
Custom configurations via EXTEND.md. See Preferences section for paths and supported options.
Weekly Installs
74
Repository
GitHub Stars
24
First Seen
Mar 5, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
openclaw58
opencode45
gemini-cli45
github-copilot45
amp45
cline45
LarkSuite Whiteboard CLI 工具:自动化生成专业图表与画板,支持DSL和Mermaid
37,400 周安装
ActiveCampaign自动化集成指南:通过Rube MCP实现CRM与营销自动化
72 周安装
通过Rube MCP实现Make自动化:集成Composio工具包管理场景与操作
72 周安装
Microsoft Teams自动化指南:通过Rube MCP实现频道消息、聊天与会议管理
72 周安装
Electrobun 最佳实践:TypeScript + Bun 跨平台桌面应用开发指南
72 周安装
ATXP Memory:AI代理记忆管理工具 - 云端备份与本地向量搜索
72 周安装
Brave Search Spellcheck API:智能拼写检查与查询纠正,提升搜索准确性
72 周安装
-q |
| Quality 0-100 |
| 80 |
--keep | -k | Keep original | false |
--recursive | -r | Process subdirs | false |
--json | JSON output | false |