← Back to Skills Marketplace
aga-j

ImageCompress

by aga-j · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ Security Clean
93
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install image-tiny-compress
Description
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...
README (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
Usage Guidance
This skill is coherent with its description, but note two operational risks before installing: 1) Images are uploaded to TinyPNG/Tinify servers — do not upload sensitive or private images. The script also intentionally spoofs User-Agent and X-Forwarded-For to reduce rate-limiting; while effective for reliability, that behavior can violate the service's terms or be considered abusive. If you expect heavy/bulk usage, prefer registering for TinyPNG's official API (uses an API key) to avoid misuse and potential blocking. Finally, verify you trust the skill source before executing scripts that will upload your files to the network.
Capability Assessment
Purpose & Capability
Name/description (compress images via TinyPNG web endpoint) match the code and declared requirements: python3 and the requests package. No unrelated credentials, binaries, or config paths are requested.
Instruction Scope
SKILL.md and the script confine actions to reading image files and performing POST/GET requests to tinypng.com or tinify.cn. The script explicitly spoofs User-Agent and X-Forwarded-For headers and uses randomized tokens to avoid rate-limiting — this is within the stated goal (avoid rate limiting) but is also an evasion technique that may violate Tinypng's terms of service or be viewed as abusive. The README warns about using the web frontend rather than the official API.
Install Mechanism
Install spec only pulls the Python 'requests' package. No downloads from unknown URLs or archive extraction. The listed installer kind is 'uv' (registry metadata) — this appears to map to installing the requests package and is proportionate for a Python script.
Credentials
No environment variables, secrets, or credentials are requested. The script requires network access to tinypng/tinify domains only. This is proportional to the skill's purpose.
Persistence & Privilege
Skill is user-invocable, not always-enabled, and does not request elevated or persistent system privileges. It does not modify other skills or system-wide configs.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install image-tiny-compress
  3. After installation, invoke the skill by name or use /image-tiny-compress
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.1
slug update
Metadata
Slug image-tiny-compress
Version 1.0.1
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is 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... It is an AI Agent Skill for Claude Code / OpenClaw, with 93 downloads so far.

How do I install ImageCompress?

Run "/install image-tiny-compress" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is ImageCompress free?

Yes, ImageCompress is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does ImageCompress support?

ImageCompress is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created ImageCompress?

It is built and maintained by aga-j (@aga-j); the current version is v1.0.1.

💬 Comments