← 返回 Skills 市场
aga-j

ImageCompress

作者 aga-j · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
102
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install imgae-compress
功能描述
Compress PNG, JPEG, WebP images using TinyPNG/Tinify free web API. No API key required, no login needed. Supports single/batch/directory compression with aut...
使用说明 (SKILL.md)

\r \r

TinyCompress — Smart Image Compression\r

\r \x3Cdescription>\r Use when: compressing images, optimizing image file size, reducing image size, tinypng, tinify, compress image, compress png, compress jpeg, compress webp, image optimization, shrink image, 压缩图片, 图片压缩, 图片优化, 图片瘦身, 减小图片体积\r NOT for: image resizing/cropping, format conversion, image editing, video compression\r \x3C/description>\r \r

Overview\r

\r TinyCompress uses TinyPNG/Tinify's free web API to perform high-quality lossy compression on PNG, JPEG, and WebP images. No API key, no login, no payment required.\r \r Key Features:\r

  • Free — no API key or registration needed\r
  • Supports PNG, JPEG, WebP formats\r
  • Max 5MB per image, up to 20 images per batch\r
  • Supports global server (tinypng.com) and China server (tinify.cn)\r
  • Auto retry with exponential backoff on failure\r
  • Rate-limit friendly with built-in request delays\r
  • Typical compression: 50%~80% size reduction with near-zero visual quality loss\r \r

Prerequisites\r

\r

  • Python 3.6+ must be installed\r
  • requests library: pip install requests\r
  • Network access to tinypng.com or tinify.cn\r \r

Usage\r

\r

1. Single Image Compression\r

\r When a user uploads or specifies one image:\r \r

python "{SKILL_DIR}/scripts/tiny_compress.py" compress "\x3Cimage_path>"\r
```\r
\r
Use China server for faster speed in China:\r
```bash\r
python "{SKILL_DIR}/scripts/tiny_compress.py" compress "\x3Cimage_path>" --server cn\r
```\r
\r
Output: generates `\x3Cfilename>_compressed.\x3Cext>` in the same directory.\r
\r
### 2. Batch Compression\r
\r
When a user provides multiple images:\r
\r
```bash\r
python "{SKILL_DIR}/scripts/tiny_compress.py" compress "\x3Cfile1>" "\x3Cfile2>" ... --output-dir "\x3Coutput_dir>"\r
```\r
\r
### 3. Directory Compression\r
\r
When a user specifies a directory:\r
\r
```bash\r
python "{SKILL_DIR}/scripts/tiny_compress.py" compress-dir "\x3Cdir_path>" --output-dir "\x3Coutput_dir>"\r
```\r
\r
Add `--recursive` to include subdirectories.\r
\r
### 4. Overwrite Mode\r
\r
When user explicitly wants to replace original files:\r
\r
```bash\r
python "{SKILL_DIR}/scripts/tiny_compress.py" compress "\x3Cfile>" --overwrite\r
```\r
\r
⚠️ **Warning:** Overwriting is irreversible. Always warn the user and suggest backup first.\r
\r
## Script Reference\r
\r
### scripts/tiny_compress.py\r
\r
| Subcommand | Description |\r
|------------|-------------|\r
| `compress \x3Cfiles...>` | Compress one or more image files |\r
| `compress-dir \x3Cdir>` | Compress all images in a directory |\r
\r
| Parameter | Description | Default |\r
|-----------|-------------|---------|\r
| `--output-dir \x3Cdir>` | Output directory | Same dir with `_compressed` suffix |\r
| `--server cn\|global` | Server selection | `global` |\r
| `--overwrite` | Overwrite original files | `false` |\r
| `--recursive` | Recurse into subdirectories (compress-dir only) | `false` |\r
\r
**How it works:**\r
- Upload endpoint: `POST https://tinypng.com/backend/opt/shrink` (or `tinify.cn/backend/opt/shrink`)\r
- Uploads raw image binary → server returns compression info + download URL → downloads compressed image\r
- Uses randomized User-Agent and X-Forwarded-For headers\r
- Serial processing with 1.5s delay between requests to avoid rate limiting\r
- Auto retry up to 3 times with exponential backoff\r
\r
**Output format (per image):**\r
```json\r
{\r
  "success": true,\r
  "file": "original_path",\r
  "output": "output_path",\r
  "original_size": 1234567,\r
  "compressed_size": 345678,\r
  "saved_bytes": 888889,\r
  "saved_percent": 72.0\r
}\r
```\r
\r
## Examples\r
\r
```\r
User: "Compress this image" (uploads photo.png)\r
Agent: runs compress on photo.png → returns photo_compressed.png with stats\r
\r
User: "Compress all images in ./screenshots"\r
Agent: runs compress-dir ./screenshots → returns compressed versions\r
\r
User: "Use China server, compress these 3 photos"\r
Agent: runs compress with --server cn on all 3 files\r
```\r
\r
## Limitations\r
\r
- Max 5MB per image (TinyPNG web limit)\r
- Max 20 images per batch\r
- This uses TinyPNG's web frontend endpoint (not official API), may change without notice\r
- High-frequency requests may be temporarily rate-limited\r
- Does not support AVIF, GIF, BMP formats\r
- Uploaded images are auto-deleted from TinyPNG servers after 48 hours\r
\r
## Important Notes\r
\r
- **Privacy:** Images are uploaded to TinyPNG servers for processing. Do NOT upload images containing sensitive/personal information.\r
- **Fair Use:** This method simulates web browser access. Use responsibly, avoid excessive automated calls.\r
- **Network:** Requires access to tinypng.com or tinify.cn.\r
- **Alternative:** For heavy batch processing, consider registering for TinyPNG's official API key (500 free compressions/month).\r
安全使用建议
This skill appears to do what it says (compress images via TinyPNG's web endpoint), but there are important caveats to consider before installing or running it: - Privacy: images are uploaded to tinypng.com/tinify.cn for processing. Do not upload sensitive or personal images. The code warns about this, but it's your responsibility. - Unofficial API & header spoofing: the script uses the web frontend endpoint (not the official API) and deliberately forges headers (random X-Forwarded-For and User-Agent) to simulate browser requests and reduce rate-limiting. That behavior can violate TinyPNG's terms of service, may be considered abusive, and could get your IP blocked. If you plan heavy use, prefer registering for the official API key as the SKILL.md itself recommends. - Data handling: the tool can overwrite originals with --overwrite; warn users and back up important files first. - Operational safety: run the script in a sandboxed environment first to confirm behavior; inspect the code if you have doubts (it is included). Monitor network activity if you are in a sensitive environment. Given these points the skill is coherent with its stated purpose but carries moderate risk due to deliberate rate-limit evasion techniques and use of an unofficial endpoint. If you need high-volume or sensitive processing, use TinyPNG's official API with an API key or a vetted library instead.
功能分析
Type: OpenClaw Skill Name: imgae-compress Version: 1.0.0 The skill compresses images by uploading them to the TinyPNG/Tinify web API, which involves inherent privacy risks and broad file/network access. The script `scripts/tiny_compress.py` includes logic to evade rate limiting by randomizing `User-Agent` and `X-Forwarded-For` headers to spoof different client identities. While the behavior aligns with the stated purpose in `SKILL.md`, the use of an unofficial endpoint and identity-spoofing techniques are considered risky behaviors under the provided criteria.
能力评估
Purpose & Capability
Name, description, required binary (python3), dependency (requests), and the included script all align with an image compression tool that uploads images to TinyPNG/Tinify. The requested resources are proportionate to the stated purpose.
Instruction Scope
SKILL.md and the script instruct uploading user images to tinypng.com or tinify.cn, downloading compressed results, and writing output files — which matches purpose. However the instructions and code explicitly implement header spoofing (random X-Forwarded-For and randomized User-Agent) and use an unofficial web frontend endpoint (/backend/opt/shrink). That is outside ordinary client behavior, intended to simulate/evade browser protections and rate limits; this raises ethical, ToS, and network-abuse concerns. The skill does warn users about privacy and not uploading sensitive images.
Install Mechanism
Install spec only requires the 'requests' Python package (via the registry's 'uv' package kind). This is a typical, low-risk dependency and no arbitrary downloads or extracted archives are present.
Credentials
The skill requests no environment variables, no credentials, and no config paths. It does not attempt to access unrelated system secrets. This is proportionate to its function.
Persistence & Privilege
The skill is not always-enabled, does not request elevated privileges, and does not modify other skills or system-wide agent settings. It reads and writes only the files the user asks it to compress.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install imgae-compress
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /imgae-compress 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of ImageCompress — smart image compression using TinyPNG/Tinify web API. - Compress PNG, JPEG, and WebP images for free without API key or login - Supports single image, batch, and directory compression (including optional recursion) - Automatic retry, request delays, and rate-limit handling built in - Works with both tinypng.com (global) and tinify.cn (China) servers - Command-line interface outputting compressed files with detailed stats - Requires Python 3.6+ and the requests library
元数据
Slug imgae-compress
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

ImageCompress 是什么?

Compress PNG, JPEG, WebP images using TinyPNG/Tinify free web API. No API key required, no login needed. Supports single/batch/directory compression with aut... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 102 次。

如何安装 ImageCompress?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install imgae-compress」即可一键安装,无需额外配置。

ImageCompress 是免费的吗?

是的,ImageCompress 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

ImageCompress 支持哪些平台?

ImageCompress 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 ImageCompress?

由 aga-j(@aga-j)开发并维护,当前版本 v1.0.0。

💬 留言讨论