PHP | Imagick coalesceImages() Function
Last Updated :
25 Jul, 2019
The Imagick::coalscaleImages() function is an inbuilt function in PHP which is used to combined the set of images into single image. It composites a set of images with respect to any page offsets and disposal methods. The animation sequences GIF, MIFF, and MNG are typically start with an image background and each subsequent image varies in size and offset.
Syntax:
Imagick Imagick::coalesceImages( void )
Parameters: This function does not accepts any parameters.
Return Value: It returns an Imagick object on success.
Below program illustrates the Imagick::coalscaleImages() function in PHP:
Program: This program generates an animated gif image from a set of images.
<?php
$images = [
];
$temp = new Imagick();
foreach ( $images as $image ) {
$temp ->readImage( $image );
$temp ->setImageDelay(100);
}
$temp ->setImageFormat( 'gif' );
$gif = $temp ->coalesceImages();
$gif ->setImageFormat( 'gif' );
$gif ->setImageIterations(0);
header( "Content-Type: image/gif" );
echo $gif ->getImagesBlob();
?>
|
Output:
Reference: https://www.php.net/manual/en/imagick.coalesceimages.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...