(PHP 4, PHP 5, PHP 7)
imagecolorat — 取锟斤拷某锟斤拷锟截碉拷锟斤拷色锟斤拷锟斤拷值
$image
, int $x
, int $y
) : int
锟斤拷锟斤拷 image
锟斤拷指锟斤拷锟斤拷图锟斤拷锟斤拷指锟斤拷位锟斤拷锟斤拷锟截碉拷锟斤拷色锟斤拷锟斤拷值锟斤拷
锟斤拷锟� PHP 锟斤拷锟斤拷时锟斤拷锟斤拷锟斤拷 GD 锟斤拷 2.0 锟斤拷锟斤拷叩陌姹撅拷锟斤拷锟酵硷拷锟斤拷锟斤拷锟斤拷色图锟斤拷锟津本猴拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟截该碉拷锟� RGB 值锟斤拷锟斤拷锟斤拷位锟斤拷锟斤拷锟斤拷锟斤拷取锟矫红,锟教o拷锟斤拷锟斤拷锟皆成分碉拷值锟斤拷
Example #1 取锟矫革拷锟皆碉拷 RGB 值
<?php
$im = ImageCreateFromPng("rockym.png");
$rgb = ImageColorAt($im, 100, 100);
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
?>
锟轿硷拷 imagecolorset() 锟斤拷 imagecolorsforindex()锟斤拷