Annotates an image with text.
Touch/mouse over to see original View modified in new window.
Image
Stroke color
 
Fill color
 
Annotates an image with text.
Parameters
draw_settingsImagickDrawThe ImagickDraw object that contains settings for drawing the text
xfloatHorizontal offset in pixels to the left of text
yfloatVertical offset in pixels to the baseline of text
anglefloatThe angle at which to write the text
textstringThe string to draw
function annotateImage($imagePath, $strokeColor, $fillColor)
{
    $imagick = new \Imagick(realpath($imagePath));

    $draw = new \ImagickDraw();
    $draw->setStrokeColor($strokeColor);
    $draw->setFillColor($fillColor);

    $draw->setStrokeWidth(1);
    $draw->setFontSize(36);
    
    $text = "Imagick is a native php \nextension to create and \nmodify images using the\nImageMagick API.";

    $draw->setFont("../fonts/Arial.ttf");
    $imagick->annotateimage($draw, 40, 40, 0, $text);

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