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)import requests
response = requests.post(
"https://api.convertfilefast.com/v2/image/compress",
headers={"Authorization": "Bearer YOUR_API_KEY"},
files={"file": open("photo.jpg", "rb")},
data={"quality": 80}
)
with open("compressed.jpg", "wb") as f:
f.write(response.content)const formData = new FormData();
formData.append("file", fs.createReadStream("photo.jpg"));
formData.append("quality", "80");
const response = await fetch(
"https://api.convertfilefast.com/v2/image/compress",
{
method: "POST",
headers: { "Authorization": "Bearer YOUR_API_KEY" },
body: formData,
}
);
fs.writeFileSync("compressed.jpg", Buffer.from(await response.arrayBuffer()));// n8n HTTP Request Node — Compress Image
{
"method": "POST",
"url": "https://api.convertfilefast.com/v2/image/compress",
"contentType": "multipart-form-data",
"bodyParameters": {
"parameters": [
{ "name": "file", "parameterType": "formBinaryData", "inputDataFieldName": "data" },
{ "name": "quality", "value": "80" }
]
},
"options": { "response": { "responseFormat": "file" } }
}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.
How it works
4 steps to run this conversion
- 1
Create an API key
Sign up at convertfilefast.com/signup and copy your cff_ API key from the dashboard. The free tier includes 10 conversions per month.
- 2
POST the image to the endpoint
Send a multipart/form-data POST to https://api.convertfilefast.com/v2/image/compress with header X-API-Key: cff_your_key (Authorization: Bearer also works), the image as a file field or a public url field, and an optional quality value, plus max_width / max_height to cap dimensions.
- 3
Receive the image
The response body is the resulting image, streamed back with a Content-Disposition filename. Save it or pass it straight to the next step of your pipeline — nothing is stored on our side.
- 4
Or invoke it from an AI agent
Add the MCP server to Claude, Cursor or any MCP-compatible client using https://mcp.convertfilefast.com/mcp, then call compress_image({ source_url: '...', quality: 80 }) as a single tool call — no HTTP client, no file handling.
Or call this from Claude, Cursor, or any MCP client
Convert File Fast ships a native Model Context Protocol server. Give this conversion to an AI agent as a single tool call — no HTTP client, no binary handling, per-user API keys.
npx -y convertfilefast-mcpcompress_image({ source_url: "https://example.com/photo.jpg", quality: 80 })Compared with
Convert File Fast vs alternatives
| Product | Native MCP | Free tier | Price |
|---|---|---|---|
| Convert File Fast | Yes | 10/month | $0.004/conv from $4 |
| Smallpdf | No | 2/day (unregistered) | $9/mo Pro |
| iLovePDF | No | Rate-limited | $7/mo Premium |
| Adobe Acrobat Online | No | Limited trials | $19.99/mo Acrobat Standard |
| CloudConvert | No | 25 conv-min | From $0.01/min |
Competitor pricing checked on 2026-07-16.
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?
Limits depend on your plan and are enforced per API key — the API reports the ceiling it currently accepts at https://api.convertfilefast.com/v1/info, and your own plan limit is shown in your dashboard.
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.