Skip to content

Instantly share code, notes, and snippets.

@symisc
Created March 23, 2021 01:24
Show Gist options
  • Save symisc/dcd4f22672f5201eeb1cc439ef857df3 to your computer and use it in GitHub Desktop.
Save symisc/dcd4f22672f5201eeb1cc439ef857df3 to your computer and use it in GitHub Desktop.
Generate a GIF file from a set of static image using the PixLab API - https://pixlab.io/cmd?id=makegif
import requests
import json
# Generate GIF file from a set of static image - https://pixlab.io/cmd?id=makegif
req = requests.post(
'https://api.pixlab.io/makegif',
headers={
'Content-Type':'application/json'
},data=json.dumps({
'key':'PIXLAB_API_KEY', # Your PixLab API Key. Get yours from https://pixlab.io/dashboard
'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"
}
]
}))
reply = req.json()
if reply['status'] != 200:
print (reply['error'])
else:
print ("GIF location: "+ reply['link'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment