Created
March 30, 2021 22:20
-
-
Save symisc/9d0d08ddb4a4471ed98c616383f820bd to your computer and use it in GitHub Desktop.
Composite a static image on top of a GIF using the PixLab API - https://pixlab.io/cmd?id=gifcomposite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* PixLab PHP Client which is just a single class PHP file without any dependency that you can get from Github | |
* https://github.com/symisc/pixlab-php | |
*/ | |
require_once "pixlab.php"; | |
# Composite a static image on top of a GIF. | |
# If you want to composite multiple images, then use the `merge` command instead. | |
# https://pixlab.io/cmd?id=gifcomposite | |
$gif = 'http://i.stack.imgur.com/h8Hjm.gif'; | |
# Static images to be displayed starting from frame 5 | |
$static = 'http://i.stack.imgur.com/WFr1K.png'; | |
$pix = new Pixlab('My_Pix_Key'); | |
if( !$pix->get('gifcomposite',[ | |
'img' => $gif, | |
'composite' => $static, | |
'x' => 10, | |
'y' => 30, | |
'frame' => 5, # Display the result starting from frame number 5 | |
]) ){ | |
echo $pix->get_error_message()."\n"; | |
die; | |
} | |
echo "GIF Location: ".$pix->json->link."\n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment