Links
Comment on page

Generate animated GIFs

How to generate animated GIFs - Abyssale REST API
Animated GIFs can be created by sending data and customisation parameters to the POST /async/banner-builder/{template_id}/generate endpoint (with the image_file_type property equals to gif), which will respond synchronously with only a generation_request_id property.
Once the generation is completed, the result will then be posted to the callback_url (webhooks system).
GIF asynchronous generation (with Webhooks)
  • Supported template type: Animated
  • Generation response type: Asynchronous (Webhooks or Polling)
  • The animated GIF is exported at maximum 9 fps.
  • All duplicated frames will be removed.
  • By default, infinite looping is defined.
In addition to the supported image properties, a gif property can be sent through the Abyssale REST API call to customise the generated GIF. Here are the available options:
  • repeat: Sets the number of times that the GIF should repeat after its first iteration.
    • Default value is -1 : The GIF will repeat indefinitely.
    • Value of 0: Play only once.
    • Value of 1: Play twice
    • ....
  • max_fps: Maximum number of frame per second. Default value is 9
    • Min: 2
    • Max: 9

File compression level

You can optionally set the file_compression_level. The "File Compression Level" option allows you to fine-tune the balance between file size and quality when processing files. You can choose a value between 1 and 100, where 1 represents the highest compression for the smallest file size (lower quality), and 100 signifies the best quality with larger file sizes. The default value is 100.
"file_compression_level": 100

Sample request

​Do not forget to replace {YOUR-API-KEY} and {templateId}
cURL
Javascript
Python
curl -X POST -H "x-api-key:{YOUR-API-KEY}" -H "Content-Type: application/json" \
-d '{
"callback_url": "https://webhook.mycompany.com/images",
"image_file_type": "gif",
"gif": {
"max_fps": 9,
"repeat": -1
},
"template_format_names": ["facebook-feed", "instagram-post", "iab-medium"],
"elements": {
"primary_text": {
"payload": "New branding available.",
"color": "#FF0000"
}
}
}' \
https://api.abyssale.com/async/banner-builder/{template_id}/generate
const axios = require('axios');
const payload = {
"callback_url": "https://webhook.mycompany.com/images",
"image_file_type": "gif",
"gif": {
"max_fps": 9,
"repeat": -1
},
"template_format_names": ["facebook-feed", "instagram-post", "iab-medium"],
"elements": {
"primary_text": {
"payload": "New branding available.",
"color": "#FF0000"
}
}
}
// Replace {id} by your template ID
axios.post("https://api.abyssale.com/async/banner-builder/{id}/generate", payload, {
headers: {"x-api-key": "{YOUR-API-KEY}", "Content-Type": "application/json", "timeout": 30000}
}).then(response => {
console.log(response.data)
}j
import json
import requests
image_generation_payload = {
"callback_url": "https://webhook.mycompany.com/images",
"image_file_type": "gif",
"gif": {
"max_fps": 9,
"repeat": -1
},
"template_format_names": ["facebook-feed", "instagram-post", "iab-medium"],
"elements": {
"primary_text": {
"payload": "New branding available.",
"color": "#FF0000"
}
}
}
# Do not forget to replace {YOUR-API-KEY} and {template_id}
r = requests.post("https://api.abyssale.com/async/banner-builder/{template_id}/generate",
headers={"x-api-key": "YOUR-API-KEY", "Content-Type": "application/json"},
data=json.dumps(image_generation_payload),
timeout=30
)
r.json()
All formats of a template can be generated by removing the template_format_names property.