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...
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, 压缩图片, 图片压缩, 图片优化, 图片瘦身, 减小图片体积 NOT for: image resizing/cropping, format conversion, image editing, video compression
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.
Key Features:
pip install requeststinypng.com or tinify.cnWhen a user uploads or specifies one image:
bash
python "{SKILL_DIR}/scripts/tiny_compress.py" compress "<image_path>"
Use China server for faster speed in China:
bash
python "{SKILL_DIR}/scripts/tiny_compress.py" compress "<image_path>" --server cn
Output: generates <filename>_compressed.<ext> in the same directory.
When a user provides multiple images:
bash
python "{SKILL_DIR}/scripts/tiny_compress.py" compress "<file1>" "<file2>" ... --output-dir "<output_dir>"
When a user specifies a directory:
bash
python "{SKILL_DIR}/scripts/tiny_compress.py" compress-dir "<dir_path>" --output-dir "<output_dir>"
Add --recursive to include subdirectories.
When user explicitly wants to replace original files:
bash
python "{SKILL_DIR}/scripts/tiny_compress.py" compress "<file>" --overwrite
⚠️ Warning: Overwriting is irreversible. Always warn the user and suggest backup first.
SubcommandDescriptioncompress <files...>Compress one or more image filescompress-dir <dir>Compress all images in a directoryParameterDescriptionDefault--output-dir <dir>Output directorySame dir with _compressed suffix--server cn|globalServer selectionglobal``--overwriteOverwrite original filesfalse``--recursiveRecurse into subdirectories (compress-dir only)false
How it works:
POST https://tinypng.com/backend/opt/shrink (or tinify.cn/backend/opt/shrink)Output format (per image):
json
{
"success": true,
"file": "original_path",
"output": "output_path",
"original_size": 1234567,
"compressed_size": 345678,
"saved_bytes": 888889,
"saved_percent": 72.0
}
text
User: "Compress this image" (uploads photo.png)
Agent: runs compress on photo.png → returns photo_compressed.png with stats
User: "Compress all images in ./screenshots"
Agent: runs compress-dir ./screenshots → returns compressed versions
User: "Use China server, compress these 3 photos"
Agent: runs compress with --server cn on all 3 files