HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelTutorial Source codeReport an issue

Montage image

← modulateImage   morphImages →
Creates a composite image by combining several separate images. The images are tiled on the composite image with the name of the image optionally appearing just below the individual tile.
function montageImage($montageType)
    $draw = new \ImagickDraw();

    $imagick = new \Imagick();

    $mosaicWidth = 500;
    $mosaicHeight = 500;
    $imagick->newimage($mosaicWidth, $mosaicHeight, 'red');

    $images = [

    $count = 0;
    foreach ($images as $image) {
        $nextImage = new \Imagick(realpath($image));
        $nextImage->labelImage("Label $count");

    $montage = $imagick->montageImage(
        "3x2+0+0", //tile_geometry
        "200x160+3+3>", //thumbnail_geometry
        $montageType, //\Imagick::MONTAGEMODE_CONCATENATE,
    header("Content-Type: image/png");
    echo $montage->getImageBlob();