I am developing a service that will combine static images with animated pictures. In howling script I use the following PHP algorithm:
Code: Select all
$animation = new Imagick();
$animation->setFormat("GIF");
$gif = new Imagick('img/gif/anim.gif');
$gif = $gif->coalesceImages();
foreach ($gif as $frame) {
$canvas -> compositeImage($frame , imagick::COMPOSITE_DEFAULT , 0,0);
$animation->addImage($canvas);
$animation->nextImage();
}
$animation->writeImages('gallery/gif/'.$fileName.'.gif', true);
echo "/gallery/gif/".$fileName.".gif";
Picture generated about 30 seconds, which in itself - quite a lot.
1. Are there ways to increase the speed s software image generation?
2. Is it possible to combine with a translucent gradient PNG and GIF, while maintaining transparency gradient? How do previous frames without layering on each other?