GIF Compressor
Compress GIF images and animations to reduce file size. Supports both static and animated GIFs.
Try GIF 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.gif-compress |
| Category | images |
| Endpoint | POST /compress/gif |
| Input formats | .gif |
| 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=@animation.gif" | 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 "animation-compressed.gif"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("animation.gif")), "file", "animation.gif");
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("animation-compressed.gif", 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 "animation.gif" }
# 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 "animation-compressed.gif"Options
The GIF compressor supports resize -- scale down images and animations while compressing. See Options for the full resize reference.
# compress + resize to 720p
curl -sS -X POST "https://api.tools.fast/compress" \
-H "X-Fast-Api-Key: $API_KEY" \
-F "file=@animation.gif" \
-F 'options={"_schemaVersion":1,"resize":{"enabled":true,"preset":"720p","mode":"pixels","value":null}}'using var form = new MultipartFormDataContent();
form.Add(new ByteArrayContent(File.ReadAllBytes("animation.gif")), "file", "animation.gif");
form.Add(new StringContent(
"""{"_schemaVersion":1,"resize":{"enabled":true,"preset":"720p","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 "animation.gif"
options = '{"_schemaVersion":1,"resize":{"enabled":true,"preset":"720p","mode":"pixels","value":null}}'
}Notes
- Output format:
.gif-- same as input. - Animation frames and timing are preserved during compression.
- The compressor optimizes the color palette and frame data to reduce file size.
- For static GIF images, consider converting to PNG or WebP for better compression ratios (use Convert.FAST for format conversion).