Imagick::mergeImageLayers
Merges image layers
Description
public Imagick Imagick::mergeImageLayers(int $layer_method
)
Parameters
-
layer_method
-
One of the Imagick::LAYERMETHOD_*
constants
Return Values
Returns an Imagick object containing the merged image.
Errors/Exceptions
Throws ImagickException on error.
Examples
Example #1 Imagick::mergeImageLayers
<?php
function mergeImageLayers($layerMethodType, $imagePath1, $imagePath2) {
$imagick = new \Imagick(realpath($imagePath));
$imagick2 = new \Imagick(realpath($imagePath2));
$imagick->addImage($imagick2);
$imagick->setImageFormat('png');
$result = $imagick->mergeImageLayers($layerMethodType);
header("Content-Type: image/png");
echo $result->getImageBlob();
}
?>