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 G 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 Like