Skip to content
Related Articles

Related Articles

Improve Article
PHP | Gmagick getimagecompose() Function
  • Last Updated : 21 Jan, 2020

The Gmagick::getimagecompose() function is an inbuilt function in PHP which is used to get the composite operator associated with the image. The composite operator decides the method to be used for image composition. The composite operator can be anyone from given COMPOSITE OPERATOR constants.

Syntax:

int Gmagick::getimagecompose( void )

Parameters:This function doesn’t accept any parameter.

Return Value: This function returns an integer value containing the compose operator.

Exceptions: This function throws GmagickException on error.



Below given programs illustrate the Gmagick::getimagecompose() function in PHP:

Program 1:




<?php
  
// Create a new Gmagick object
$gmagick = new Gmagick('geeksforgeeks.png');
  
// Get the image compose
$compose $gmagick->getimagecompose();
echo $compose;
?>

Output:

1 // Which is the default composite operator for all Gmagick object.

Program 2:




<?php
  
// Create a new Gmagick object
$gmagick = new Gmagick('geeksforgeeks.png');
  
// Set the image compose
$gmagick->setimagecompose(Gmagick::COMPOSITE_COLORIZE);
  
// Get the image compose
$compose $gmagick->getimagecompose();
echo $compose;
?>

Output:

28

Reference: https://www.php.net/manual/en/gmagick.getimagecompose.php

My Personal Notes arrow_drop_up
Recommended Articles
Page :