English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
imagecolorat — Get the color index value of a pixel.
int imagecolorat(resource $image, int $x, int $y)
Returns the color index value of the pixel at the specified position in the image specified by image.
If the GD library is added when PHP is compiled 2If the PHP version is 0.0 or higher and the image is a true-color image, this function returns the RGB value of the point as an integer. Use bit shifting and masking to get the value of the red, green, and blue components separately.
Get the individual RGB values.
<?php $im = ImageCreateFromPng("w3codebox- $rgb = ImageColorAt($im, 100, 25); $r = ($rgb >> 16) & 0xFF; $g = ($rgb >> 8) & 0xFF; $b = $rgb & 0xFF; ?>
imagecolorset() Set the color for the specified palette index.
imagecolorsforindex() Get the color of an index.