Friday, October 10, 2025
HomeLanguagesPHP | Imagick setImageGreenPrimary() Function

PHP | Imagick setImageGreenPrimary() Function

The Imagick::setImageGreenPrimary() function is an inbuilt function in PHP which is used to set the image chromaticity green primary point.

Syntax:

bool Imagick::setImageGreenPrimary( float $x, float $y )

Parameters: This function accept two parameters as mentioned above and described below:

  • $x: It specifies the green primary x-point.
  • $y: It specifies the green primary y-point.

Return Value: This function returns TRUE on success.

Exceptions: This function throws ImagickException on error.

Below programs illustrate the Imagick::setImageGreenPrimary() function in PHP:

Program 1:




<?php
  
// Create a new imagick object
$imagick = new Imagick(
  
// Use setImageGreenPrimary() function
$imagick->setImageGreenPrimary(9, 11);
  
// Use getImageGreenPrimary() function
$result = $imagick->getImageGreenPrimary();
print_r($result);
?>


Output:

Array ( [x] => 9 [y] => 11 )

Program 2:




<?php
  
// Create a new imagick object
$imagick = new Imagick(
  
// Use setImageGreenPrimary() function
$imagick->setImageGreenPrimary(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.setimagegreenprimary.php

RELATED ARTICLES

Most Popular

Dominic
32349 POSTS0 COMMENTS
Milvus
87 POSTS0 COMMENTS
Nango Kala
6715 POSTS0 COMMENTS
Nicole Veronica
11878 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11941 POSTS0 COMMENTS
Shaida Kate Naidoo
6837 POSTS0 COMMENTS
Ted Musemwa
7097 POSTS0 COMMENTS
Thapelo Manthata
6792 POSTS0 COMMENTS
Umr Jansen
6791 POSTS0 COMMENTS