HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelTutorial Source codeReport an issue

Composite image

← complexImages   contrastImage →
Composite one image onto another at the specified offset. Any extra arguments needed for the compose algorithm should passed to setImageArtifact with 'compose:args' as the first parameter and the data as the second parameter.
This is a simple example. Please look at the full composite tutorial for more examples.

function compositeImage()
    $img1 = new \Imagick();

    $img2 = new \Imagick();


    $opacity = new \Imagick();
    $opacity->rotateimage('black', 90);

    $img2->compositeImage($opacity, \Imagick::COMPOSITE_COPYOPACITY, 0, 0);
    $img1->compositeImage($img2, \Imagick::COMPOSITE_ATOP, 0, 0);

    header("Content-Type: image/jpeg");
    echo $img1->getImageBlob();