Skip to content

ImagickPixel

  • Full name: \ImagickPixel

See Also:

  • https://php.net/manual/en/class.imagickpixel.php -

Methods

getHSL

(PECL imagick 2.0.0)
Returns the normalized HSL color of the ImagickPixel object

public getHSL(): array

Return Value:

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

Throws:

on failure

See Also:

  • https://php.net/manual/en/imagickpixel.gethsl.php -

setHSL

(PECL imagick 2.0.0)
Sets the normalized HSL color

public setHSL(float $hue, float $saturation, float $luminosity): bool

Parameters:

Parameter Type Description
$hue float <p>
The normalized value for hue, described as a fractional arc
(between 0 and 1) of the hue circle, where the zero value is
red.
</p>
$saturation float <p>
The normalized value for saturation, with 1 as full saturation.
</p>
$luminosity float <p>
The normalized value for luminosity, on a scale from black at
0 to white at 1, with the full HS value at 0.5 luminosity.
</p>

Return Value:

TRUE on success.

See Also:

  • https://php.net/manual/en/imagickpixel.sethsl.php -

getColorValueQuantum

public getColorValueQuantum(): mixed

setColorValueQuantum

public setColorValueQuantum(mixed $color_value): mixed

Parameters:

Parameter Type Description
$color_value mixed

getIndex

public getIndex(): mixed

setIndex

public setIndex(mixed $index): mixed

Parameters:

Parameter Type Description
$index mixed

__construct

(PECL imagick 2.0.0)
The ImagickPixel constructor

public __construct(string $color = null): mixed

Parameters:

Parameter Type Description
$color string [optional] <p>
The optional color string to use as the initial value of this object.
</p>

See Also:

  • https://php.net/manual/en/imagickpixel.construct.php -

setColor

(PECL imagick 2.0.0)
Sets the color

public setColor(string $color): bool

Parameters:

Parameter Type Description
$color string <p>
The color definition to use in order to initialise the
ImagickPixel object.
</p>

Return Value:

TRUE if the specified color was set, FALSE otherwise.

See Also:

  • https://php.net/manual/en/imagickpixel.setcolor.php -

setColorValue

(PECL imagick 2.0.0)
Sets the normalized value of one of the channels

public setColorValue(int $color, float $value): bool

Parameters:

Parameter Type Description
$color int <p>
One of the Imagick color constants e.g. \Imagick::COLOR_GREEN or \Imagick::COLOR_ALPHA.
</p>
$value float <p>
The value to set this channel to, ranging from 0 to 1.
</p>

Return Value:

TRUE on success.

See Also:

  • https://php.net/manual/en/imagickpixel.setcolorvalue.php -

getColorValue

(PECL imagick 2.0.0)
Gets the normalized value of the provided color channel

public getColorValue(int $color): float

Parameters:

Parameter Type Description
$color int <p>
The color to get the value of, specified as one of the Imagick color
constants. This can be one of the RGB colors, CMYK colors, alpha and
opacity e.g (Imagick::COLOR_BLUE, Imagick::COLOR_MAGENTA).
</p>

Return Value:

The value of the channel, as a normalized floating-point number, throwing ImagickPixelException on error.

Throws:

on error

See Also:

  • https://php.net/manual/en/imagickpixel.getcolorvalue.php -

clear

(PECL imagick 2.0.0)
Clears resources associated with this object

public clear(): bool

Return Value:

TRUE on success.

See Also:

  • https://php.net/manual/en/imagickpixel.clear.php -

destroy

(PECL imagick 2.0.0)
Deallocates resources associated with this object

public destroy(): bool

Return Value:

TRUE on success.

See Also:

  • https://php.net/manual/en/imagickpixel.destroy.php -

isSimilar

(PECL imagick 2.0.0)
Check the distance between this color and another

public isSimilar(\ImagickPixel $color, float $fuzz): bool

Parameters:

Parameter Type Description
$color \ImagickPixel <p>
The ImagickPixel object to compare this object against.
</p>
$fuzz float <p>
The maximum distance within which to consider these colors as similar.
The theoretical maximum for this value is the square root of three
(1.732).
</p>

Return Value:

TRUE on success.

See Also:

  • https://php.net/manual/en/imagickpixel.issimilar.php -

isPixelSimilar

(No version information available, might only be in SVN)
Check the distance between this color and another

public isPixelSimilar(\ImagickPixel $color, float $fuzz): bool

Parameters:

Parameter Type Description
$color \ImagickPixel <p>
The ImagickPixel object to compare this object against.
</p>
$fuzz float <p>
The maximum distance within which to consider these colors as similar.
The theoretical maximum for this value is the square root of three
(1.732).
</p>

Return Value:

TRUE on success.

See Also:

  • https://php.net/manual/en/imagickpixel.ispixelsimilar.php -

getColor

(PECL imagick 2.0.0)
Returns the color

public getColor(bool $normalized = false): array

Parameters:

Parameter Type Description
$normalized bool [optional] <p>
Normalize the color values
</p>

Return Value:

An array of channel values, each normalized if TRUE is given as param. Throws ImagickPixelException on error.

Throws:

on error.

See Also:

  • https://php.net/manual/en/imagickpixel.getcolor.php -

getColorAsString

(PECL imagick 2.1.0)
Returns the color as a string

public getColorAsString(): string

Return Value:

the color of the ImagickPixel object as a string.

See Also:

  • https://php.net/manual/en/imagickpixel.getcolorasstring.php -

getColorCount

(PECL imagick 2.0.0)
Returns the color count associated with this color

public getColorCount(): int

Return Value:

the color count as an integer on success, throws ImagickPixelException on failure.

Throws:

on failure.

See Also:

  • https://php.net/manual/en/imagickpixel.getcolorcount.php -

setColorCount

public setColorCount(mixed $colorCount): mixed

Parameters:

Parameter Type Description
$colorCount mixed

isPixelSimilarQuantum

Returns true if the distance between two colors is less than the specified distance. The fuzz value should be in the range 0-QuantumRange.
The maximum value represents the longest possible distance in the colorspace. e.g. from RGB(0, 0, 0) to RGB(255, 255, 255) for the RGB colorspace

public isPixelSimilarQuantum(mixed $color, string $fuzz): bool

Parameters:

Parameter Type Description
$color mixed
$fuzz string

See Also:

  • https://php.net/manual/en/imagickpixel.ispixelsimilarquantum.php -

getColorQuantum

Returns the color of the pixel in an array as Quantum values. If ImageMagick was compiled as HDRI these will be floats, otherwise they will be integers.

public getColorQuantum(): mixed

Return Value:

The quantum value of the color element. Float if ImageMagick was compiled with HDRI, otherwise an int.

See Also:

  • https://php.net/manual/en/imagickpixel.getcolorquantum.php -

setColorFromPixel

Sets the color count associated with this color from another ImagickPixel object.

public setColorFromPixel(\ImagickPixel $srcPixel): bool

Parameters:

Parameter Type Description
$srcPixel \ImagickPixel


Automatically generated on 2025-03-18