Skip to content
Related Articles

Related Articles

Improve Article
PHP | Imagick morphImages() Function
  • Difficulty Level : Medium
  • Last Updated : 26 Aug, 2019

The Imagick::morphImages function is an inbuilt function in PHP which is used to morph a set of images. The image pixels and size of the image are linearly interpolated to give the appearance of metamorphosis from one image to the next.


Imagick Imagick::morphImages( $number_frames )

Parameters: This function accepts single parameter $number_frames which is used to store the number of in-between images to generate.

Return Value: This function returns new Imagick object on success.

Original Images:

Below program isllustrate the Imagick::morphImages function in PHP:

// Set of images
$images = [
// Create new Imagick object
$imagick = new \Imagick(realpath($images[count($images) - 1]));
foreach ($images as $image) {
    $nextImage = new \Imagick(realpath($image));
// Use morphImages function
$morphed = $imagick->morphImages(5);
header("Content-Type: image/gif");
// Set the image format
// Display the output image
echo $morphed->getImagesBlob();



My Personal Notes arrow_drop_up
Recommended Articles
Page :