(PHP 4 >= 4.0.6, PHP 5, PHP 7)
imagecolorexactalpha — 取锟斤拷指锟斤拷锟斤拷锟斤拷色锟斤拷透锟斤拷锟饺碉拷锟斤拷锟斤拷值
$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.
锟斤拷锟斤拷图锟斤拷锟缴拷锟斤拷锟街革拷锟斤拷锟缴拷锟酵革拷锟斤拷鹊锟斤拷锟斤拷锟街碉拷锟� 锟斤拷锟斤拷锟缴拷锟斤拷锟酵硷拷锟侥碉拷色锟斤拷锟叫o拷锟斤拷锟斤拷 -1锟斤拷
Example #1 Get colors from the GD logo
<?php
// Setup an image
$im = imagecreatefrompng('./gdlogo.png');
$colors = Array();
$colors[] = imagecolorexactalpha($im, 255, 0, 0, 0);
$colors[] = imagecolorexactalpha($im, 0, 0, 0, 127);
$colors[] = imagecolorexactalpha($im, 255, 255, 255, 55);
$colors[] = imagecolorexactalpha($im, 100, 255, 52, 20);
print_r($colors);
// Free from memory
imagedestroy($im);
?>
锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�
Array ( [0] => 16711680 [1] => 2130706432 [2] => 939524095 [3] => 342163252 )
Note: 锟剿猴拷锟斤拷锟斤拷要 GD 2.0.1 锟斤拷锟斤拷甙姹�(锟狡硷拷 2.0.28 锟斤拷锟斤拷锟竭版本)锟斤拷