Open In App

PHP | Gmagick getimagegreenprimary() Function

Last Updated : 21 Jan, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

The Gmagick::getimagegreenprimary() function is an inbuilt function in PHP which is used to returns the chromaticity green primary point. This functions returns an array with keys “x” and “y”.

Syntax:

array Gmagick::getimagegreenprimary( void )

Parameters: This function doesn’t accept any parameter.

Return Value: This function returns an array value containing the x and y coordinates of point.

Exceptions: This function throws GmagickException on error.

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

Program 1:




<?php
  
// Create a new Gmagick object
$gmagick = new Gmagick('geeksforgeeks.png');
  
// Use the getimagegreenprimary() function
$res = $gmagick->getimagegreenprimary();
print("<pre>".print_r($res, true)."</pre>");
?>


Output:

Array
(
    [x] => 0.30000001192093
    [y] => 0.60000002384186
)

Program 2:




<?php
  
// Create a new Gmagick object
$gmagick = new Gmagick('geeksforgeeks.png');
  
// Use the setimagegreenprimary() function
$gmagick->setimagegreenprimary(6, 8);
  
// Use the getimagegreenprimary() function
$res = $gmagick->getimagegreenprimary();
print("<pre>".print_r($res, true)."</pre>");
?>


Output:

Array
(
    [x] => 6
    [y] => 8
)

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



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads