TL;DR
ReSmush is a free image compression API that reduces PNG and JPEG file sizes using smart optimization algorithms. Upload an image URL or raw file data, and get back a compressed version with dramatically smaller file size while preserving visual quality. Supports JPEG (lossy compression) and PNG (lossless compression). Returns the compressed image with compression ratio statistics. JSON response includes original size, compressed size, and savings percentage. No API key. A must-have for web developers optimizing page load times.
Quick start: https://api.resmush.it/ws.php?img=https://example.com/image.jpg
No API key needed — just make a request!
How to Use This API
1. Compress an Image by URL
https://api.resmush.it/ws.php?img=https://example.com/image.jpg
2. JavaScript — Compress and Display
const imageUrl = 'https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png';
fetch(`https://api.resmush.it/ws.php?img=${encodeURIComponent(imageUrl)}`)
.then(r => r.json())
.then(data => {
console.log(`Original: ${data.src_size} bytes`);
console.log(`Compressed: ${data.dest_size} bytes`);
console.log(`Savings: ${data.percent}%`);
console.log(`Result URL: ${data.dest}`);
});
3. Python — Batch Compress Images
import requests
images = [
'https://example.com/photo1.jpg',
'https://example.com/photo2.jpg',
'https://example.com/photo3.png',
]
for img_url in images:
data = requests.get(
'https://api.resmush.it/ws.php',
params={'img': img_url}
).json()
savings = data.get('percent', 0)
print(f"{img_url.split('/')[-1]}: {savings}% reduction "
f"({data.get('src_size', 0)} → {data.get('dest_size', 0)} bytes)")
https://api.resmush.it/ws.php?img=https://example.com/image.jpg
Frequently Asked Questions
- What image formats are supported?
- JPEG (lossy compression) and PNG (lossless compression). The API auto-detects the format and applies appropriate optimization.
- How much compression can I expect?
- Typical savings range from 20-80% depending on image content. Photos with lots of detail compress less, while simple graphics and screenshots compress dramatically.
- How do I upload a file directly?
- Use a POST request with the
filesfield containing the image data, or pass a publicly accessible URL with theimgGET parameter. - What is returned in the response?
- JSON with: dest (compressed image URL), src_size (original bytes), dest_size (compressed bytes), percent (savings percentage), and status code.
- What is the maximum file size?
- The free tier supports images up to 5MB. For larger images, consider resizing before compression or using a local Smush/ImageOptim tool.
- Is there a rate limit?
- ReSmush is a free public service with reasonable usage limits. For high-volume production use, consider self-hosting similar optimization tools.
API Details
- API URL
https://api.resmush.it/ws.php- Documentation
- resmush.it/api
- Category
- Developer Tools
- Authentication
- Not Required
- Geographic Coverage
- Global
What You Can Build
- Image optimization pipeline for static site generators (Hugo, Jekyll, 11ty)
- CMS plugin that auto-compresses uploaded images before storage
- Batch image processor for web developers optimizing entire asset directories
- CDN pre-processing service that compresses images on-the-fly
- Performance audit tool measuring image compression opportunities on pages