Image Compressor
/install image-compressor
\r \r
Image Compressor\r
\r
基于 rv-image-optimize 的图片压缩、上传与格式转换 skill。 \r
An image compression, upload, and format-conversion skill powered by rv-image-optimize.\r
\r
核心功能 / Features\r
\r
- 压缩单张或批量图片 / Compress single images or whole folders\r
- 转换
jpeg、png、webp、avif/ Convert betweenjpeg,png,webp, andavif\r - 压缩时限制尺寸 / Resize while compressing with max width and height\r
- 通过
upload子命令按FormData配置上传文件 / Upload files through theuploadsubcommand withFormDataconfig\r - 通过
pipeline子命令一条命令完成“压缩 + 上传” / Complete "compress + upload" in one command with thepipelinesubcommand\r - 通过
chunkUpload配置执行分片上传 / 断点续传 / Run chunked and resumable uploads throughchunkUploadconfig\r - 输出结构化 JSON 结果 / Return structured JSON summaries for agents\r
- 默认安全输出到新目录 / Default to safe output in a new directory\r \r
何时使用 / When to use\r
\r 当用户提到以下需求时使用:\r \r
- “压缩图片”\r
- “图片太大”\r
- “减小文件大小”\r
- “转成 WebP / AVIF”\r
- “批量处理整个图片目录”\r
- “压缩时顺便缩小尺寸”\r
- “让 Agent / CLI 自动处理图片”\r
- “压缩后上传到接口”\r
- “按接口配置上传文件”\r
- “大文件分片上传”\r
- “断点续传”\r \r Use this skill when the user asks to:\r \r
- compress one or more images\r
- reduce image file size\r
- convert images to
webporavif\r - batch-process an image folder\r
- resize images while compressing\r
- run image optimization from an agent or CLI workflow\r
- upload files to an API through CLI\r
- compress files and immediately upload them\r
- perform chunked uploads for large files\r
- resume interrupted uploads\r \r
默认策略 / Default behavior\r
\r 除非用户明确要求修改原图,否则优先使用安全模式:\r \r
- 使用
--output-dir输出到新目录\r - 使用
--json方便 Agent 汇总结果\r - 默认不删除原图\r
- 默认不替换原图\r
- 大文件上传优先把
chunkUpload写进--config\r \r Preferred command:\r \r
rv-image-optimize "{input}" --output-dir "{outputDir}" --format webp --quality 82 --json\r
```\r
\r
如果全局命令不可用,可回退到:\r
\r
```bash\r
npx rv-image-optimize "{input}" --output-dir "{outputDir}" --format webp --quality 82 --json\r
```\r
\r
如果任务是“压缩后上传接口”,优先使用:\r
\r
```bash\r
rv-image-optimize pipeline "{input}" --format webp --quality 82 --config "{configPath}" --json\r
```\r
\r
如果任务是“已有文件直接上传接口”,优先使用:\r
\r
```bash\r
rv-image-optimize upload "{input}" --config "{configPath}" --json\r
```\r
\r
## 安全规则 / Safety rules\r
\r
以下选项只有在用户明确要求时才允许使用:\r
\r
- `--delete-original`\r
- `--replace-original`\r
\r
`--replace-original` 不能和以下参数一起使用:\r
\r
- `--output`\r
- `--output-dir`\r
- `--suffix`\r
\r
If the user wants to preserve source files, always choose `--output-dir`.\r
\r
上传相关安全约定:\r
\r
- 当前只保留 `FormData` 请求方式\r
- 复杂上传字段优先写进 `--config` JSON 文件\r
- 大文件 / 可恢复上传优先使用 `chunkUpload` 配置块\r
- `Authorization`、`Cookie`、`Content-Type` 优先用配置文件显式字段表达\r
- `Content-Type` 在 `FormData` 模式下通常建议留空,让运行时自动生成 boundary\r
\r
## 常用命令 / Common recipes\r
\r
### 单张图片压缩 / Compress a single image\r
\r
```bash\r
rv-image-optimize "./photo.jpg" --output-dir "./compressed" --format webp --quality 82 --json\r
```\r
\r
### 批量压缩目录 / Compress a folder\r
\r
```bash\r
rv-image-optimize "./images" --output-dir "./images-compressed" --format webp --quality 82 --json\r
```\r
\r
### 调整尺寸并压缩 / Resize and compress\r
\r
```bash\r
rv-image-optimize "./images" --output-dir "./images-compressed" --format webp --quality 82 --max-width 1920 --max-height 1080 --json\r
```\r
\r
### 压缩成功后删除原图 / Delete originals after success\r
\r
```bash\r
rv-image-optimize "./images" --output-dir "./images-compressed" --format webp --quality 82 --delete-original --json\r
```\r
\r
### 直接替换原图 / Replace originals in place\r
\r
```bash\r
rv-image-optimize "./images" --format webp --quality 82 --replace-original --json\r
```\r
\r
### 直接上传已有文件 / Upload existing files\r
\r
```bash\r
rv-image-optimize upload "./dist/demo.webp" --config "./upload.config.json" --json\r
```\r
\r
### 分片上传 / 断点续传 / Chunked resumable upload\r
\r
```bash\r
rv-image-optimize upload "./large-assets" --config "./upload.chunk.config.json" --timeout-ms 10000 --json\r
```\r
\r
### 压缩后直接上传 / Compress then upload\r
\r
```bash\r
rv-image-optimize pipeline "./images" --format webp --quality 82 --config "./upload.config.json" --json\r
```\r
\r
### 仅预览上传字段 / Preview upload fields only\r
\r
```bash\r
rv-image-optimize upload "./dist/demo.webp" --config "./upload.config.json" --preview-only --json\r
```\r
\r
## 汇报结果 / Reporting results\r
\r
使用 `--json` 时,建议汇总:\r
\r
- `total`\r
- `success`\r
- `failed`\r
- 输出目录或是否替换了原图\r
- 失败文件列表\r
- 上传模式下的 HTTP 状态码或预览字段\r
\r
## 推荐参数 / Recommended defaults\r
\r
- 默认格式:`webp`\r
- 默认质量:`82`\r
- 更小体积优先且接受更慢编码时:`avif`\r
- 上传任务默认优先使用 `--config`\r
- 大文件上传默认优先使用 `chunkUpload`\r
- 压缩后上传默认优先使用 `pipeline`\r
- 如需更多示例和参数说明,见 [reference.md](reference.md)\r
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install image-compressor - After installation, invoke the skill by name or use
/image-compressor - Provide required inputs per the skill's parameter spec and get structured output
What is Image Compressor?
基于 `rv-image-optimize` 的图片压缩、上传与一体化压缩后上传 skill,支持 JPEG/PNG/WebP/AVIF、批量目录处理、FormData 接口配置与 JSON 结果汇总。Use when the user asks to compress images, upload optimi... It is an AI Agent Skill for Claude Code / OpenClaw, with 150 downloads so far.
How do I install Image Compressor?
Run "/install image-compressor" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Image Compressor free?
Yes, Image Compressor is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Image Compressor support?
Image Compressor is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Image Compressor?
It is built and maintained by ziji1224054593 (@ziji1224054593); the current version is v3.0.30.