PHP | Imagick appendImages() Function
The Imagick::appendImages() function is an inbuilt function in PHP which is used to append set of images. This function appends a set of images into a single image.
Syntax:
Imagick::appendImages( $stack )
Parameters: This function accepts a single parameters $stack which is mandatory. If the stack value is false then images stacked from left to right and if the stack value is true then image stacked from top to bottom. The default value of the stack is false.
Return Value: This function returns Imagick instance on success.
Errors/Exceptions: This function throws ImagickException on error.
Below programs illustrate the Imagick::appendImages() function in PHP:
Program 1:
<?php /* Create new imagick object */$image = new Imagick(); /* create red, green and blue images */$image->newImage(600, 70, "red"); $image->newImage(600, 70, "white"); $image->newImage(600, 70, "green"); /* Append the images into one */$image->resetIterator(); $combined = $image->appendImages(true); /* Output the image */$combined->setImageFormat("png"); header("Content-Type: image/png"); echo $combined; ?> |
Output:

Program 2:
<?php /* Create new imagick object */$image = new Imagick(); /* create red, green and blue images */$image->newImage(210, 200, "red"); $image->newImage(210, 200, "white"); $image->newImage(210, 200, "green"); /* Append the images into one */$image->resetIterator(); $combined = $image->appendImages(false); /* Output the image */$combined->setImageFormat("png"); header("Content-Type: image/png"); echo $combined; ?> |
Output:

Related Articles:
Reference: http://php.net/manual/en/imagick.appendimages.php
Recommended Posts:
- PHP | Imagick getPointSize() Function
- PHP | Imagick colorFloodfillImage() Function
- PHP | Imagick linearStretchImage() Function
- PHP | Imagick charcoalImage() Function
- PHP | Imagick setSizeOffset() Function
- PHP | Imagick setFormat() Function
- PHP | Imagick getImageWidth() Function
- PHP | Imagick getImageHeight() Function
- PHP | Imagick getFont() Function
- PHP | Imagick coalesceImages() Function
- PHP | Imagick setCompression() Function
- PHP | Imagick getSizeOffset() Function
- PHP | Imagick setFont() Function
- PHP | Imagick setPage() Function
- PHP | Imagick getPixelIterator() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

