PHP | GmagickDraw annotate() Function Last Updated : 21 Jan, 2020 Comments Improve Suggest changes Like Article Like Report The GmagickDraw::annotate() function is an inbuilt function in PHP which is used to draw the text on the image. Syntax: GmagickDraw GmagickDraw::annotate( float $x, float $y, string $text ) Parameters: This function accept three parameters as mentioned above and described below: $x: It specifies the x-coordinate of the text. $y: It specifies the y-coordinate of the text. $text: It specifies the text content. Return Value: This function returns GmagickDraw object on success. Exceptions: This function throws GmagickException on error. Below given programs illustrate the GmagickDraw::annotate() function in PHP: Used Image: Program 1 (Adding text to a drawing): php <?php // Create a new Gmagick object $gmagick = new Gmagick('geeksforgeeks.png'); // Create a GmagickDraw object $draw = new GmagickDraw(); // Set the color $draw->setFillColor('white'); // Function to draw rectangle $draw->rectangle(0, 0, 800, 400); // Set the fill color $draw->setFillColor('red'); // Set the font size $draw->setfontsize(80); // Annotate a text $draw->annotate(30, 120, 'GeeksforGeeks'); // Use of drawimage function $gmagick->drawImage($draw); // Display the output image header("Content-Type: image/png"); echo $gmagick->getImageBlob(); ?> Output: Program 2 (Adding text to a image): php <?php // Create a new Gmagick object $gmagick = new Gmagick('geeksforgeeks.png'); // Create a GmagickDraw object $draw = new GmagickDraw(); // Set the fill color $draw->setFillColor('green'); // Set the font size $draw->setfontsize(30); // Annotate a text $draw->annotate(100, 120, 'This line is drawn with annotate'); // Use of drawimage function $gmagick->drawImage($draw); // Display the output image header("Content-Type: image/png"); echo $gmagick->getImageBlob(); ?> Output: Reference: https://www.php.net/manual/en/gmagickdraw.annotate.php Create Quiz Comment G gurrrung Follow 0 Improve G gurrrung Follow 0 Improve Article Tags : Web Technologies PHP PHP-function PHP-Gmagick Explore BasicsPHP Syntax4 min readPHP Variables5 min readPHP | Functions6 min readPHP Loops4 min readArrayPHP Arrays5 min readPHP Associative Arrays4 min readMultidimensional arrays in PHP5 min readSorting Arrays in PHP4 min readOOPs & InterfacesPHP Classes2 min readPHP | Constructors and Destructors5 min readPHP Access Modifiers4 min readMultiple Inheritance in PHP4 min readMySQL DatabasePHP | MySQL Database Introduction4 min readPHP Database connection2 min readPHP | MySQL ( Creating Database )3 min readPHP | MySQL ( Creating Table )3 min readPHP AdvancePHP Superglobals6 min readPHP | Regular Expressions12 min readPHP Form Handling4 min readPHP File Handling4 min readPHP | Uploading File3 min readPHP Cookies9 min readPHP | Sessions7 min read Like