(PHP 4 >= 4.0.6, PHP 5, PHP 7)
imagecolorresolvealpha — 取锟斤拷指锟斤拷锟斤拷色 + alpha 锟斤拷锟斤拷锟斤拷值锟斤拷锟叫匡拷锟杰得碉拷锟斤拷锟斤拷咏锟斤拷锟斤拷锟斤拷值
$image
, int $red
, int $green
, int $blue
, int $alpha
) : int锟斤拷锟斤拷锟斤拷锟斤拷锟皆憋拷证锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟缴拷锟斤拷锟揭伙拷锟斤拷锟缴拷锟斤拷锟斤拷锟揭达拷锟饺凤拷锟街狄达拷锟斤拷锟斤拷艿玫锟斤拷锟接斤拷锟斤拷锟斤拷锟街碉拷锟�
image
锟斤拷图锟襟创斤拷锟斤拷锟斤拷(锟斤拷锟斤拷imagecreatetruecolor())锟斤拷锟截碉拷图锟斤拷锟斤拷源锟斤拷
red
锟斤拷色锟缴分碉拷值锟斤拷
green
锟斤拷色锟缴分碉拷值锟斤拷
blue
锟斤拷色锟缴分碉拷值锟斤拷
alpha
A value between 0 and 127. 0 indicates completely opaque while 127 indicates completely transparent.
Returns a color index.
Example #1 Using imagecoloresolvealpha() to get colors from an image
<?php
// Load an image
$im = imagecreatefromgif('phplogo.gif');
// Get closest colors from the image
$colors = array();
$colors[] = imagecolorresolvealpha($im, 255, 255, 255, 0);
$colors[] = imagecolorresolvealpha($im, 0, 0, 200, 127);
// Output
print_r($colors);
imagedestroy($im);
?>
锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�
Array ( [0] => 89 [1] => 85 )
Note: 锟剿猴拷锟斤拷锟斤拷要 GD 2.0.1 锟斤拷锟斤拷甙姹�(锟狡硷拷 2.0.28 锟斤拷锟斤拷锟竭版本)锟斤拷