PHP | imageaffine() Function Last Updated : 28 Jan, 2020 Comments Improve Suggest changes Like Article Like Report The imageaffine() function is an inbuilt function in PHP which is used to get an image containing the affine transformed src image using an optional clipping area. Affine is a geometric transformation operation involving MATRICES. Syntax: resource imageaffine( resource $image, array $affine, array $clip ) Parameters: This function accept three parameters as mentioned above and described below: $image: It specifies the image resource. $affine: It specifies the array with keys 0 to 5. $clip: It specifies the area to be clipped. Return Value: This function returns affined image resource on success or FALSE on failure. Exceptions: This function throws Exception on error. Below given programs illustrate the imageaffine() function in PHP: Program 1: php <?php // Create a image from url $im = imagecreatefrompng( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); // Affine the image $newimage = imageaffine($im, [ -1.3, 0, 0, -0.7, 0, 0 ]); // Output the image header('Content-Type: image/png'); imagepng($newimage); ?> Output: Program 2: php <?php // Create a image from url $im = imagecreatefrompng( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); $clipped = [ 'x' => 0, 'y' => 0, 'width' => 200, 'height' => 200, ]; // Affine the image $newimage = imageaffine($im, [-1, 0, 0, sin(4), 0, 0], $clipped); // Output the image header('Content-Type: image/png'); imagepng($newimage); ?> Output: Reference: https://www.php.net/manual/en/function.imageaffine.php Comment More infoAdvertise with us Next Article PHP | imageaffine() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | imagefill() Function The imagefill() function is an inbuilt function in PHP which is used to fill the image with the given color. This function performs a flood fill starting at the given coordinate (top left is 0, 0) with the given color in the image. Syntax: bool imagefill( $image, $x, $y, $color ) Parameters:This fun 2 min read PHP | imageaffinematrixget() function The imageaffinematrixget() function is an inbuilt function in PHP which is used to get an affine transformation matrix. Affine is a geometric transformation operation involving matrices, often used in linear algebra and computer graphics.Syntax:Â Â array imageaffinematrixget( int $type, mixed $option 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 | imagegif() Function The imagegif() function is an inbuilt function in PHP which is used to create the GIF image file from the given image. If the image has been made transparent with imagecolortransparent() function, then GIF89a image format will generate otherwise GIF87a image format will generate. Syntax: bool imageg 2 min read PHP | imagejpeg() Function The imagejpeg() 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 JPEG and altering the quality of the image. Syntax: bool imagejpeg( resource $image, int $to, in 2 min read Like