Compress Images to Reduce File Size via API
Compress JPEG, PNG, and WebP images via REST API to reduce file size while maintaining visual quality. Upload your image as multipart/form-data with a quality parameter and receive the compressed image in response.
# Compress an image to reduce file size
curl -X POST \
https://api.convertfilefast.com/v2/image/compress \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@photo.jpg" \
-F "quality=80" \
--output compressed.jpg
# HTTP 200 OK — Content-Type: image/jpeg
# quality: 1-100 (default 85)Advantages
Why use our API?
Complete and reliable solution for integration in any tech stack.
Quality Control
Set quality from 1 to 100 to balance file size and visual quality. Default is 85 for optimal results.
Simple Upload
Upload your image as multipart/form-data and receive the compressed binary in response. No configuration required.
Web Performance
Optimize images for web delivery. Reduce page load times by compressing hero images, product photos, and galleries.
Storage Savings
Compress images before storing in S3, Google Drive, or Cloudinary. Reduce storage costs across large image libraries.
n8n Integration
Add image compression to n8n workflows. Compress uploaded images before saving or emailing them automatically.
Zero Storage
Images are processed in memory and deleted immediately after compression. Your files are never stored on our servers.
FAQ
Frequently Asked Questions
How do I compress images via the API?
Send a POST request to https://api.convertfilefast.com/v2/image/compress with multipart/form-data including your image file and an optional quality parameter (1-100). The compressed image is returned in the response body. See the code examples above for cURL, Python, and Node.js.
What image formats are supported for compression?
The API supports JPEG, PNG, WebP, AVIF, HEIC, BMP, and TIFF. Each format uses the appropriate compression algorithm: lossy for JPEG, lossless or palette reduction for PNG, and modern codecs for WebP and AVIF.
How does the quality parameter affect compression?
The quality parameter accepts values from 1 (smallest file, lowest fidelity) to 100 (largest file, highest fidelity). The default is 85, which works well for most web images. We recommend 75-85 for web delivery and 90+ when fidelity is critical.
Does the API support lossless compression?
Yes. PNG and WebP support lossless compression by default - no visual data is lost. JPEG is inherently lossy but uses optimized encoding to minimize visible artifacts. For lossless workflows, send PNG or WebP inputs.
What are the file size limits for image compression?
The free tier accepts files up to 25 MB per request. Paid tiers raise the limit to 200 MB. See the /docs page for the full list of limits per plan and rate limits per API key.
Can I integrate image compression in n8n, Zapier, or batch pipelines?
Yes. The REST endpoint works with any HTTP client - we provide ready-to-use snippets for cURL, Python requests, Node.js fetch, and an n8n HTTP Request node configuration. Compress images before storing them in S3, Cloudinary, or any CDN.
Related Tools
Start Compressing Images via API
Get your API key and compress images to reduce file size in seconds. Free plan includes 10 conversions per month.
No credit card. 10 free conversions on Free plan.