Open In App

PHP | Gmagick getimageredprimary() Function

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

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

Syntax:

array Gmagick::getimageredprimary( void )

Parameters: This function doesn’t accept any parameters.

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

Exceptions: This function throws GmagickException on error.

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

Used Image:

Program 1:




<?php
  
// Create a new Gmagick object
$gmagick = new Gmagick('geeksforgeeks.png');
  
// Use getimageredprimary function 
$res = $gmagick->getimageredprimary(); 
print_r($res); 
?>


Output:

Array ( [x] => 0.63999998569489 [y] => 0.33000001311302 )

Program 2:




<?php
  
// Create a new Gmagick object
$gmagick = new Gmagick('geeksforgeeks.png');
  
// Use setimageredprimary function
$gmagick->setimageredprimary(4, 8);
  
// Use getimageredprimary function 
$res = $gmagick->getimageredprimary(); 
print_r($res); 
?> 


Output:

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

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


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

Similar Reads