Open In App

PHP | Imagick setImageRedPrimary() Function

Last Updated : 21 Nov, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
The Imagick::setImageRedPrimary() function is an inbuilt function in PHP which is used to set the image chromaticity red primary point. Syntax:
bool Imagick::setImageRedPrimary( float $x, float $y )
Parameters: This function accept two parameters as mentioned above and described below:
  • $x: It specifies the red primary x-point.
  • $y: It specifies the red primary y-point.
Return Value: This function returns TRUE on success. Exceptions: This function throws ImagickException on error. Below given programs illustrate the Imagick::setImageRedPrimary() function in PHP: Program 1: php
<?php

// Create a new imagick object
$imagick = new Imagick(
'https://media.geeksforgeeks.org/wp-content/uploads/20190823154611/geeksforgeeks24.png');

// Use setImageRedPrimary() function
$imagick->setImageRedPrimary(5, 8);

// Use getImageRedPrimary() function
$result = $imagick->getImageRedPrimary();
print_r($result);
?>
Output:
Array ( [x] => 5 [y] => 8 )
Program 2: php
<?php

// Create a new imagick object
$imagick = new Imagick(
'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png');

// Use setImageRedPrimary() function
$imagick->setImageRedPrimary(0.2, 0.8);

// Display the image
$imagick->setformat('png');
header("Content-Type: image/png");

echo $imagick->getImageBlob();
?>
Output: Reference: https://www.php.net/manual/en/imagick.setimageredprimary.php

Next Article

Similar Reads