function annotateImage($image_path, $strokeColor, $fillColor) { $imagick = new \Imagick(realpath($image_path)); $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/jpeg"); echo $imagick->getImageBlob(); }