PHP | Gmagick compositeimage() Function Last Updated : 14 Jan, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The Gmagick::compositeimage() function is an inbuilt function in PHP which is used to composite one image onto another at the specified offset. Offset is actually the distance from where to start compositing the second image. Syntax: Gmagick Gmagick::compositeimage( Gmagick $source, int $COMPOSE, int $x, int $y ) Parameters: This function accepts four parameters as mentioned above and described below: $source: It specifies the source of image to composite with another image. $compose: It specifies the type of composition to apply. $x: It specifies the x-coordinate. $y: It specifies the y-coordinate. Return Value: This function returns a Gmagick object containing the composite image. Exceptions: This function throws GmagickException on error. Below programs illustrate the Gmagick::compositeimage() function in PHP: Program 1: This program uses Gmagick::compositeimage() function to composite two images with no offset. php <?php // Create two new Gmagick object $gmagick1 = new Gmagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); $gmagick2 = new Gmagick( 'https://media.geeksforgeeks.org/wp-content/uploads/20190918234528/colorize1.png'); // Composite the images with no offset $gmagick1->compositeimage($gmagick2, Gmagick::COMPOSITE_MULTIPLY, 0, 0); // Output the image header('Content-type: image/png'); echo $gmagick1; ?> Output: Program 2: This program uses Gmagick::compositeimage() function to composite two image with offset. php <?php // Create two new Gmagick object $gmagick1 = new Gmagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); $gmagick2 = new Gmagick( 'https://media.geeksforgeeks.org/wp-content/uploads/20190918234528/colorize1.png'); // Composite the images with offset $gmagick1->compositeimage($gmagick2, Gmagick::COMPOSITE_OVER, 300, 0); // Output the image header('Content-type: image/png'); echo $gmagick1; ?> Output: Reference: https://www.php.net/manual/en/gmagick.compositeimage.php Comment More infoAdvertise with us Next Article PHP | Gmagick commentImage() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Gmagick Similar Reads PHP | Imagick compositeImage() Function The Imagick::compositeImage() function is an inbuilt function in PHP which is used to composite one image into another image and gives composite image. Syntax: bool Imagick::compositeImage( $composite_object, $composite, $x, $y, $channel = Imagick::CHANNEL_DEFAULT ) Parameters: This function accepts 2 min read PHP | Gmagick chopimage() Function The Gmagick::chopimage() function is an inbuilt function in PHP which is used to remove the region of an image and trim it. This function accepts the dimension of image and chops the area and the dimension from where the image is to be trim.Syntax:Â Â Gmagick Gmagick::chopimage( $width, $height, $x, 2 min read PHP | Gmagick cropimage() Function The Gmagick::cropimage() function is an inbuilt function in PHP which is used to extracts the region of the image. This function crop the part of image. Syntax: public Gmagick::cropimage( $width , $height , $x , $y ) Parameters: This function accept four parameters as mention above and describe belo 2 min read PHP | Gmagick commentImage() Function The Gmagick::commentImage() function is an inbuilt function in PHP which is used to add the comment in an image. Syntax: Gmagick Gmagick::commentImage( $comment ) Parameters: This function accepts a single parameter $comment which is used to hold the comment. Return Value: This function returns the 1 min read PHP | Gmagick flopimage() Function The Gmagick::flopimage() function is an inbuilt function in PHP which is used to create a flopped image. This function creates a mirror image along the y-axis. Syntax: Gmagick Gmagick::flopimage( void ) Â Parameters: This function does not accept any parameter. Return Value: This function returns fl 1 min read PHP | Gmagick frameimage() Function The Gmagick::frameimage() function is an inbuilt function in PHP which is used to add a simulated three-dimensional border around the image. The width and height specify the border width of the vertical and horizontal sides of the frame. The inner and outer bevels indicate the width of the inner and 2 min read Like