PHP | imagecopy() Function Last Updated : 23 Aug, 2019 Comments Improve Suggest changes Like Article Like Report The imagecopy() function is an inbuilt function in PHP which is used to copy the image or part of image. This function returns true on success or false on failure. Syntax: bool imagecopy ( $dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h ) Parameters: This function accepts eight parameters as mentioned above and described below: $dst_image: This parameter is used to set destination image link resource. $src_image: This parameter is used to set source image link resource. $dst_x: This parameter is used to set x-coordinate of destination point. $dst_y: This parameter is used to set y-coordinate of destination point. $src_x: This parameter is used to set x-coordinate of source point. $src_y: This parameter is used to set x-coordinate of source point. $src_w: This parameter is used to set source width. $src_h: This parameter is used to set source height. Return Value: This function returns True on success or False on failure. Below programs illustrate the imagecopy() function in PHP. Program 1: php <?php // Create image instances $src = imagecreatefromgif( 'https://media.geeksforgeeks.org/wp-content/uploads/animateImages.gif'); $dest = imagecreatetruecolor(400, 200); // Image copy from source to destination imagecopy($dest, $src, 0, 0, 0, 0, 500, 300); // Output and free from memory header('Content-Type: image/gif'); imagegif($dest); imagedestroy($dest); imagedestroy($src); ?> Output: Program 2: php <?php // Create image instances $src = imagecreatefromgif( 'https://media.geeksforgeeks.org/wp-content/uploads/animateImages.gif'); $dest = imagecreatetruecolor(665, 180); // Image copy from source to destination imagecopy($dest, $src, 0, 0, 0, 0, 665, 180); // Output and free from memory header('Content-Type: image/gif'); imagegif($dest); imagedestroy($dest); imagedestroy($src); ?> Output: Related Articles: PHP | imagecolorallocatealpha() Function PHP | imagepolygon() Function Reference: http://php.net/manual/en/function.imagecopy.php Comment More infoAdvertise with us Next Article PHP | imagecopy() Function V vijay_raj Follow Improve Article Tags : Misc Web Technologies PHP Image-Processing PHP-function +1 More Practice Tags : Misc Similar Reads PHP | imagecrop() Function The imagecrop() function is an inbuilt function in PHP which is used to crop an image to the given rectangle. This function crops an image to the given rectangular area and returns the resulting image. The given image is not modified. Syntax: resource imagecrop ( $image, $rect ) Parameters: This fun 1 min read PHP | imagecopymerge() Function The imagecopymerge() function is an inbuilt function in PHP that is used to copy and merge the image into a single image. This function returns True on success or False on failure. Syntax:bool imagecopymerge ( $dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct )Parameters: 2 min read PHP | imagecropauto() Function The imagecropauto() function is an inbuilt function in PHP which is used to crop an image automatically using one of the available modes. Syntax: resource imagecropauto( resource $image, int $mode, float $threshold, int $color ) Parameters: This function accepts four parameters as mentioned above an 2 min read PHP | imagepng() Function The imagepng() function is an inbuilt function in PHP which is used to display image to browser or file. The main use of this function is to view an image in the browser, convert any other image type to PNG and applying filters to the image. Syntax: bool imagepng( resource $image, int $to, int $qual 2 min read PHP | imagebmp() Function The imagebmp() function is an inbuilt function in PHP which is used to return the output or save a BMP version of the given image. Syntax: bool imagebmp( resource $image, mixed $to, bool $compressed ) Parameters: This function accept three parameters as mentioned above and described below: $image: I 1 min read Like