PHP | imagesetclip() function Last Updated : 14 Feb, 2020 Comments Improve Suggest changes Like Article Like Report The imagesetclip() function is an inbuilt function in PHP which is used to set the current clipping rectangle, i.e. the area beyond which no pixels will be drawn. Syntax: bool imagesetclip( resource $im, int $x1, int $y1, int $x2, int $y2 ) Parameters:This function accepts five parameters as mentioned above and described below: $im: It specifies the image resource to work on. $x1: It specifies the x-coordinate of the upper left corner. $y1: It specifies the y-coordinate of the upper left corner. $x2: It specifies the x-coordinate of the lower right corner. $y2: It specifies the y-coordinate of the lower right corner. Return Value: This function returns TRUE on success or FALSE on failure. Below given programs illustrate the imagesetclip() function in PHP Program 1: php <?php // Load the png image $image = imagecreatefrompng( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); // Set the clip imagesetclip($image, 0, 0, 40, 40); // Get the clip $clip = imagegetclip($image); print("<pre>".print_r($clip, true)."</pre>"); ?> Output: Array ( [0] => 0 [1] => 0 [2] => 40 [3] => 40 ) Program 2: php <?php // Load the png image $image = imagecreatefrompng( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); // Set the clip imagesetclip($image, 20, 20, 150, 150); // Create a line from upper left corner to (400, 400) // and you will see the line doesn't start from upper // left corner because it is clipped from (20, 20) $red = imagecolorallocate($image, 255, 0, 0); imageline($image, 0, 0, 400, 400, $red); // Output image to the browser header('Content-type: image/png'); imagepng($image); ?> Output: Reference: https://www.php.net/manual/en/function.imagesetclip.php Comment More infoAdvertise with us Next Article PHP | imagesetclip() function gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP | imagegetclip() Function The ImagickDraw::imagegetclip() function is an inbuilt function in PHP which is used to get the current clipping rectangle, i.e. the area beyond the no of pixels will be drawn. Default clipping area is the whole image which can be customized using imagesetclip() function. Syntax: array ImagickDraw:: 1 min read PHP | imageflip() Function The imageflip() function is an inbuilt function in PHP which is used to Flip an image horizontally, vertically or both horizontally and vertically using the given mode. Syntax: bool imageflip( $image, $mode ) Parameters: This function accepts two parameters as mentioned above and described below: $i 2 min read PHP | imagesettile() Function The imagesettile() function is an inbuilt function in PHP which is used to set the tile image for filling the area. Syntax: bool imagesettile( $image, $tile ) Parameters: This function accepts two parameters as mentioned above and described below: $image: It is returned by one of the image creation 2 min read PHP | imagesetpixel() Function The imagesetpixel() function is an inbuilt function in PHP which is used to draw a pixel at the specified coordinate.Syntax:Â bool imagesetpixel( resource $image, int $x, int $y, int $color ) Parameters: This function accept four parameters as mentioned above and described below:Â $image: It specifies 2 min read PHP | imagesetstyle() function The imagesetstyle() function is an inbuilt function in PHP which is used to set the style to be used by all line drawing functions like imageline() or imagepolygon(). Syntax: bool imagesetstyle( resource $image, array $style ) Parameters:This function accepts two parameters as mentioned above and de 2 min read 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 | imagecopy() Function 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 eigh 2 min read PHP | imagewebp() Function The imagewebp() 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 WebP and alter the quality of the image.Syntax:Â bool imagewebp( resource $image, int $to, int $q 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 | imagesetbrush() function The imagesetbrush() function is an inbuilt function in PHP which is used to set the brush image for line drawing. Line drawing is done using functions like imageline() or imagepolygon(). Special colors can be drawn using IMG_COLOR_BRUSHED or IMG_COLOR_STYLEDBRUSHED. Syntax: bool imagesetbrush( resou 2 min read Like