Merges a sequence of images. This is useful for combining Photoshop layers into a single image.
Merges a sequence of images. This is useful for combining Photoshop layers into a single image.
function flattenImages()
{
    $imagick = new \Imagick(realpath("images/LayerTest.psd"));
    $imagick->flattenimages();
    $imagick->setImageFormat('png');
    header("Content-Type: image/png");
    echo $imagick->getImageBlob();
}