ImagickPixel::setColorValueQuantum

(No version information available, might only be in Git)
Description
public void ImagickPixel::setColorValueQuantum ( int $color, mixed $value )

Sets the quantum value of a color element of the ImagickPixel.

Parameters:
color

Which color element to set e.g. \Imagick::COLOR_GREEN.

value

The quantum value to set the color element to. This should be a float if ImageMagick was compiled with HDRI otherwise an int in the range 0 to Imagick::getQuantum().

Returns:

This function is currently not documented; only its argument list is available.

Examples:
ImagickPixel::setColorValueQuantum()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
function setColorValueQuantum() {
    $image new \Imagick();
 
    $quantumRange $image->getQuantumRange();
 
    $draw new \ImagickDraw();
    $color new \ImagickPixel('blue');
    $color->setcolorValueQuantum(\Imagick::COLOR_RED, 128 * $quantumRange['quantumRangeLong'] / 256);
 
    $draw->setstrokewidth(1.0);
    $draw->setStrokeColor($color);
    $draw->setFillColor($color);
    $draw->rectangle(200, 200, 300, 300);
 
    $image->newImage(500, 500, "SteelBlue2");
    $image->setImageFormat("png");
 
    $image->drawImage($draw);
 
    header("Content-Type: image/png");
    echo $image->getImageBlob();
}
 
?>
doc_php
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.