GIF → JPEG
Try it interactively →POST /api/gif-to-jpegConvert a GIF to a JPEG. Extracts the first frame of the GIF and re-encodes it with mozjpeg. JPEG has no transparency, so transparent GIF pixels are flattened to white (or your chosen background colour).
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| gif* | file | — | Input GIF. |
| quality | number (1…100) | 80 | JPEG quality (1–100). |
| background | string | "#ffffff" | Background colour for transparent pixels, as #RRGGBB. |
Response
Modes: binary, json. Cache: yes (24h TTL).
Code samples
Built from the dog example.
# Download or substitute the example input:
# curl -O https://xtract.bot/examples/gif-extract-frames/dog.gif
GIF=$(base64 -w0 < dog.gif)
curl -X POST https://api.xtract.bot/api/gif-to-jpeg \
-H "Content-Type: application/json" \
-H "Accept: application/octet-stream" \
-H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
-H "X-Api-Key: $XTRACT_API_KEY" \
-d '{
"gif": "'"$GIF"'"
}'