Method morphs a set of images. Both the image pixels and size are linearly interpolated to give the appearance of a meta-morphosis from one image to the next.
Method morphs a set of images. Both the image pixels and size are linearly interpolated to give the appearance of a meta-morphosis from one image to the next.
Parameters
number_framesintThe number of in-between images to generate.
function morphImages()
{
    $images = [
        //"../imagick/images/lories/IMG_1599_480.jpg",
        //"../imagick/images/lories/IMG_2837_480.jpg",
        "../imagick/images/lories/IMG_1599_480.jpg",
        "../imagick/images/lories/6E6F9109_480.jpg",
        "../imagick/images/lories/IMG_2561_480.jpg",
    ];

    $imagick = new \Imagick(realpath($images[count($images) - 1]));

    foreach ($images as $image) {
        $nextImage = new \Imagick(realpath($image));
        $imagick->addImage($nextImage);
    }

    $imagick->resetIterator();
    $morphed = $imagick->morphImages(5);
    $morphed->setImageTicksPerSecond(10);

    header("Content-Type: image/gif");
    $morphed->setImageFormat('gif');
    echo $morphed->getImagesBlob();
}