HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelDevelopmentTutorial Source codeReport an issue
Category
Example

Draw image

← distortImage   edgeImage →
Renders the ImagickDraw object on the current image.

Example

function drawImage()
{
    $strokeColor = 'black';
    $fillColor = 'plum1';

    $draw = new \ImagickDraw();

    $draw->setStrokeOpacity(1);
    $draw->setStrokeColor($strokeColor);
    $draw->setStrokeWidth(1.2);
    $draw->setFont("../fonts/Arial.ttf");
    $draw->setFontSize(64);

    $draw->setFillColor($fillColor);

    $draw->rotate(-12);
    $draw->annotation(140, 380, "c'est ne pas \nune Lorikeet!");

    $imagick = new \Imagick(realpath("../public/images/lories/IMG_1599_480.jpg"));
    $imagick->setImageFormat("png");
    $imagick->drawImage($draw);

    header("Content-Type: image/png");
    echo $imagick->getImageBlob();
}