HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelTutorial Source codeReport an issue
Category
Example

get HSL

← getColorValueQuantum   isSimilar →
Returns the normalized HSL color described by the ImagickPixel object, with each of the three values as floating point numbers between 0.0 and 1.0.
The result of getHSL for the color 'rgb(90%, 10%, 10%)' is:
hue : 0
saturation : 0.8000122074
luminosity : 0.5000076295
$colorString = 'rgb(90%, 10%, 10%)';
$output = "The result of getHSL for the color '$colorString' is:<br/>";
$color = new \ImagickPixel($colorString);
$colorInfo = $color->getHSL();
foreach ($colorInfo as $key => $value) {
    $output .= "$key : $value <br/>";
}
return $output;