API Endpoint Access URL
https://api.pixlab.io/makegif
Get Your API Key & Try MAKEGIF Now ↗Description
Generate GIF from a set of static images using the MAKEGIF API endpoint. Ideal for developers and creators looking to animate visuals. Generate GIF from a set of static images.
HTTP Methods
POST
HTTP Parameters
Required
Fields | Type | Description |
---|---|---|
frames |
Array | JSON array holding the static images URL (See below). |
key |
String | Your PixLab API Key ↗. You can also embed your key in the WWW-Authenticate: HTTP header and omit this parameter if you want to. |
Optional
Fields | Type | Description |
---|---|---|
blob |
Boolean | By default, this API endpoint return a JSON Object holding the link to the gif output. But, if this parameter is set to true then the gif binary contents is returned instead. |
delay |
Integer | Milliseconds delay between consecutive frames. |
POST Request Body
application/json
Only JSON data is allowed. The field of interest here is the frames
parameter which must be a JSON array holding the URL of each static image that compose the future GIF. The following are the required parameters for each object in the frames
array:
Fields | Type | Description |
---|---|---|
img |
URL | Input image URL. If you want to upload your image directly from your app, call store before invoking this one. |
So, a typical frames
array should look like this (See the example section for a working snippet).
frames = [
{
"img":"https://cdn1.iconfinder.com/data/icons/human-6/48/266-512.png"
},
{
"img":"https://cdn1.iconfinder.com/data/icons/human-6/48/267-512.png"
},
{
"img":"https://cdn1.iconfinder.com/data/icons/human-6/48/278-512.png"
},
{
"img":"https://cdn1.iconfinder.com/data/icons/human-6/48/279-512.png"
}
]
HTTP Response
Returns application/json
if the optional blob parameter is not set.
Returns a JSON Object after each call unless the blob parameter is specified, in which case the GIF binary content is returned directly. The JSON response contains the following fields:
Fields | Type | Description |
---|---|---|
status |
Integer | Status code 200 indicates success, any other code indicates failure. |
link |
URL | Link to the media output stored on the pixlab.xyz storage server. You can configure custom S3 storage (see your dashboard ↗ for configuration). |
id |
String | Unique media identifier. |
error |
String | Error message when status != 200. |
Code Samples
import requests
import json
from typing import Dict, Any, List
def generate_gif(api_key: str, image_urls: List[str]) -> None:
"""Generate a GIF from a set of static images using the PixLab API."""
endpoint = 'https://api.pixlab.io/makegif'
headers = {'Content-Type': 'application/json'}
frames = [{"img": url} for url in image_urls]
payload = {
'key': api_key,
'frames': frames
}
try:
response = requests.post(
endpoint,
headers=headers,
data=json.dumps(payload),
timeout=10
)
response.raise_for_status()
reply = response.json()
if reply.get('status') != 200:
print(f"Error: {reply.get('error', 'Unknown error')}")
else:
print(f"GIF location: {reply['link']}")
except requests.exceptions.RequestException as e:
print(f"Request failed: {e}")
except json.JSONDecodeError:
print("Error: Invalid JSON response")
except KeyError:
print("Error: Malformed API response")
if __name__ == "__main__":
PIXLAB_API_KEY = "My_PIXLAB_API_KEY"
IMAGE_URLS = [
"https://cdn1.iconfinder.com/data/icons/human-6/48/266-512.png",
"https://cdn1.iconfinder.com/data/icons/human-6/48/267-512.png",
"https://cdn1.iconfinder.com/data/icons/human-6/48/278-512.png",
"https://cdn1.iconfinder.com/data/icons/human-6/48/279-512.png"
]
generate_gif(PIXLAB_API_KEY, IMAGE_URLS)
fetch('https://api.pixlab.io/makegif', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
key: 'My_PIXLAB_API_KEY',
frames: [
{
img: "https://cdn1.iconfinder.com/data/icons/human-6/48/266-512.png"
},
{
img: "https://cdn1.iconfinder.com/data/icons/human-6/48/267-512.png"
},
{
img: "https://cdn1.iconfinder.com/data/icons/human-6/48/278-512.png"
},
{
img: "https://cdn1.iconfinder.com/data/icons/human-6/48/279-512.png"
}
]
})
})
.then(response => response.json())
.then(reply => {
if (reply.status !== 200) {
console.log(reply.error);
} else {
console.log("GIF location: " + reply.link);
}
})
.catch(error => console.error('Error:', error));
<?php
$data = [
'key' => 'My_PIXLAB_API_KEY',
'frames' => [
[
'img' => 'https://cdn1.iconfinder.com/data/icons/human-6/48/266-512.png'
],
[
'img' => 'https://cdn1.iconfinder.com/data/icons/human-6/48/267-512.png'
],
[
'img' => 'https://cdn1.iconfinder.com/data/icons/human-6/48/278-512.png'
],
[
'img' => 'https://cdn1.iconfinder.com/data/icons/human-6/48/279-512.png'
]
]
];
$ch = curl_init('https://api.pixlab.io/makegif');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
curl_close($ch);
$reply = json_decode($response, true);
if ($reply['status'] != 200) {
echo $reply['error'];
} else {
echo "GIF location: " . $reply['link'];
}
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse('https://api.pixlab.io/makegif')
request = Net::HTTP::Post.new(uri)
request.content_type = 'application/json'
request.body = JSON.dump({
'key' => 'My_PIXLAB_API_KEY',
'frames' => [
{
'img' => 'https://cdn1.iconfinder.com/data/icons/human-6/48/266-512.png'
},
{
'img' => 'https://cdn1.iconfinder.com/data/icons/human-6/48/267-512.png'
},
{
'img' => 'https://cdn1.iconfinder.com/data/icons/human-6/48/278-512.png'
},
{
'img' => 'https://cdn1.iconfinder.com/data/icons/human-6/48/279-512.png'
}
]
})
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
reply = JSON.parse(response.body)
if reply['status'] != 200
puts reply['error']
else
puts "GIF location: #{reply['link']}"
end
Similar API Endpoints
cropgif, resizegif, gifcomposite, merge, drawtext, mogrify, store, blur, rotate