Friday, October 24, 2025
HomeLanguagesPHP | Imagick clone() Function

PHP | Imagick clone() Function

The Imagick::clone() function is an inbuilt function in PHP which is used to create a copy of Imagick object. This function creates copy of the same instance, that means it will have same properties and any change in it will not reflect to the main object.

Syntax:

Imagick Imagick::clone( void )

Parameters: This function does not accepts any parameters.

Return Value: It returns a copy of Imagick object.

Below program illustrates the Imagick::clone() function in PHP:

Program:




<?php
  
// Create new Imagick object
$image = new Imagick(
  
// Use clone() function to copy the image
$im_clone = clone $image;
  
header("Content-Type: image/gif");
   
// Display the image
echo $im_clone->getImagesBlob();
    
?>


Output:
clone image

Reference: https://www.php.net/manual/en/imagick.clone.php

RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS