JPG Compressor
Compress JPEG images to reduce file size while preserving visual quality. Uses intelligent lossy compression to achieve significant size reductions.
Try JPG compression in the browser →
Compress.FAST uses this same API — what you see in the browser is what you get in code.
Quick reference
| Job type | image.jpg-compress |
| Category | images |
| Endpoint | POST /compress/jpg |
| Input formats | .jpg |
| Output format | same as input |
| Costing | 1 credit per 5 MB |
| Max file size | 1 GB |
| Options | resize |
Example
# 1) submit
JOB_ID=$(curl -sS -X POST "https://api.tools.fast/compress" \
-H "X-Fast-Api-Key: $API_KEY" \
-F "file=@photo.jpg" | jq -r '.id')
# 2) poll until complete
while true; do
STATUS=$(curl -sS "https://api.tools.fast/compress/job/${JOB_ID}" \
-H "X-Fast-Api-Key: $API_KEY" | jq -r '.status')
[ "${STATUS}" = "Succeeded" ] && break
[ "${STATUS}" = "Failed" ] || [ "${STATUS}" = "Canceled" ] && exit 1
sleep 1
done
# 3) download
curl -sS "https://api.tools.fast/compress/job/${JOB_ID}/download" \
-H "X-Fast-Api-Key: $API_KEY" \
-o "photo-compressed.jpg"using var http = new HttpClient();
http.DefaultRequestHeaders.Add("X-Fast-Api-Key", "fast_prod_your_key_here");
using var form = new MultipartFormDataContent();
form.Add(new ByteArrayContent(File.ReadAllBytes("photo.jpg")), "file", "photo.jpg");
var submit = await http.PostAsync("https://api.tools.fast/compress", form);
var job = await submit.Content.ReadFromJsonAsync<JsonElement>();
var jobId = job.GetProperty("id").GetString();
string status;
do
{
await Task.Delay(1000);
var poll = await http.GetFromJsonAsync<JsonElement>(
$"https://api.tools.fast/compress/job/{jobId}");
status = poll.GetProperty("status").GetString()!;
} while (status is "Queued" or "Running");
var output = await http.GetByteArrayAsync(
$"https://api.tools.fast/compress/job/{jobId}/download");
File.WriteAllBytes("photo-compressed.jpg", output);$headers = @{ "X-Fast-Api-Key" = "fast_prod_your_key_here" }
# 1) submit
$job = Invoke-RestMethod -Method Post "https://api.tools.fast/compress" `
-Headers $headers `
-Form @{ file = Get-Item "photo.jpg" }
# 2) poll until complete
do {
$status = (Invoke-RestMethod "https://api.tools.fast/compress/job/$($job.id)" `
-Headers $headers).status
if ($status -in "Failed", "Canceled") { throw "Job $($job.id) $status" }
Start-Sleep -Seconds 1
} while ($status -ne "Succeeded")
# 3) download
Invoke-RestMethod "https://api.tools.fast/compress/job/$($job.id)/download" `
-Headers $headers -OutFile "photo-compressed.jpg"Options
The JPG compressor supports resize -- scale down images while compressing. See Options for the full resize reference.
# compress + resize to 1080p
curl -sS -X POST "https://api.tools.fast/compress" \
-H "X-Fast-Api-Key: $API_KEY" \
-F "file=@photo.jpg" \
-F 'options={"_schemaVersion":1,"resize":{"enabled":true,"preset":"1080p","mode":"pixels","value":null}}'using var form = new MultipartFormDataContent();
form.Add(new ByteArrayContent(File.ReadAllBytes("photo.jpg")), "file", "photo.jpg");
form.Add(new StringContent(
"""{"_schemaVersion":1,"resize":{"enabled":true,"preset":"1080p","mode":"pixels","value":null}}"""),
"options");
var response = await http.PostAsync("https://api.tools.fast/compress", form);Invoke-RestMethod -Method Post "https://api.tools.fast/compress" `
-Headers @{ "X-Fast-Api-Key" = $Key } `
-Form @{
file = Get-Item "photo.jpg"
options = '{"_schemaVersion":1,"resize":{"enabled":true,"preset":"1080p","mode":"pixels","value":null}}'
}Notes
- Output format:
.jpg-- same as input. - EXIF metadata is preserved during compression.
- The compressor automatically selects the optimal quality level to maximize size reduction while maintaining visual fidelity.
- For compressing JPEG files alongside other image formats, use the Universal compressor instead.