PHP | ImagickDraw clone() Function Last Updated : 20 Dec, 2019 Comments Improve Suggest changes Like Article Like Report The ImagickDraw::clone() function is an inbuilt function in PHP which is used to make an exact copy of the specified ImagickDraw object. Syntax: ImagickDraw ImagickDraw::clone( void ) Parameters: This function doesn’t accepts any parameter. Return Value: This function returns the exact copy of the specified ImagickDraw object on success or error on failure. Exceptions: This function throws ImagickException on error. Below programs illustrate the ImagickDraw::clone() function in PHP: Program 1: php <?php // Create a new Imagick object $imagick = new Imagick(); // Create a image on imagick object $imagick->newImage(800, 250, 'white'); // Create a new ImagickDraw object $draw = new ImagickDraw(); // Set the text properties $draw->setFontSize(100); $draw->setFillColor('blue'); // Apply the annotation() function $draw->annotation(50, 150, 'GeeksforGeeks'); // Create a new ImagickDraw object $copied = new ImagickDraw(); // Copy the object $copied = $draw->clone(); // Render the draw commands from copied object $imagick->drawImage($copied); // Show the output $imagick->setImageFormat("png"); header("Content-Type: image/png"); echo $imagick->getImageBlob(); ?> Output: Program 2: php <?php // Create a new Imagick object $imagick = new Imagick(); // Create a image on imagick object $imagick->newImage(800, 250, 'white'); // Create a new ImagickDraw object $draw = new ImagickDraw(); // Draw a circle $draw->circle(200, 100, 100, 100); // Create a new ImagickDraw object $copied = new ImagickDraw(); // Copy the object $copied = $draw->clone(); // Render the draw commands from copied object $imagick->drawImage($copied); // Add a border $imagick->borderImage('black', 1, 1); // Show the output $imagick->setImageFormat("png"); header("Content-Type: image/png"); echo $imagick->getImageBlob(); ?> Output: Reference: https://www.php.net/manual/en/imagickdraw.clone.php Create Quiz Comment G gurrrung Follow 0 Improve G gurrrung Follow 0 Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick 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