array Imagick::getImageChannelMean (int $channel)Parameters:This function takes one parameter, $channel,which contains the channel constant valid for your channel mode. Use the bitwise operator to concatenate more than one channel type constant.Exceptions:This function will throw an ImagickException on error.Return value: this function returns TRUE on success.The following programs illustrate the Imagick::getImageChannelMean() functionin PHP:Program 1:
// Create a new imagick object
$imagick
=
new
Imagick (
’ https://media.engineerforengineer.org/wp- content / u ploads / engineerforengineer-13.png ’
);
// Get the average with CHANNEL constant as 1
// which matches imagick::CHANNEL_RED
$mean
=
$imagick
-> getImageChannelMean (1);
print_r (
$mean
);
?>
Output:Array ([mean] = > 56510.812968516 [standardDeviation] = > 20404.259764873)
Program 2:
// Create a new one imagick object
$imagick
=
new
Imagick (
’ https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-13.png ’
);
// Get the average with CHANNEL constant as 5
// which corresponds to imagick::CHANNEL_MAGENTA
$mean
=
$imagick
-> getImageChannelMean (5);
print_r (
$mean
);
?>
Output:Array ([mean] = > 57217.085522456 [standardDeviation] = > 18896.296535248)
Link:https://www.php.net/manual/en/imagick.getimagechannelmean.php