php8.5
Home/ Manual/ imagick / imagickpixel/ ImagickPixel::getHSL

ImagickPixel::getHSL

PHP function Edit on GitHub ✎

(PECL imagick 2, PECL imagick 3)

Returns the normalized HSL color of the ImagickPixel object

Description

ImagickPixel::getHSL(): array

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.

Parameters Parameters

Return Values

Returns the HSL value in an array with the keys "hue", "saturation", and "luminosity". Throws ImagickPixelException on failure.

Examples

Basic Imagick::getHSL() example

php
<?php

$color = new ImagickPixel('rgb(90%, 10%, 10%)');

$colorInfo = $color->getHSL();

print_r($colorInfo);

?>

The above example will output:

output
Array
(
    [hue] => 0
    [saturation] => 0.80001220740379
    [luminosity] => 0.50000762951095
)

Notes

Note

Available with ImageMagick library version 6.2.9 and higher.

Source: reference/imagick/imagickpixel/gethsl.xml · from the official PHP manual (php/doc-en)