📄 imagecolorclosest.php3
字号:
<HTML>
<HEAD>
<TITLE>imagecolorclosest</TITLE>
</HEAD>
<BODY>
<?
header("Content-type: image/gif");
$image = imagecreatefromgif("xitami1.gif");
// find index of color closest to pure magenta
$magentaIndex = imagecolorclosest($image, 255, 0, 255);
// get RGB values
$colorArray = imagecolorsforindex($image,
$magentaIndex);
// allocate closest color
$colorMagenta = imagecolorallocate($image,
$colorArray["red"],
$colorArray["green"],
$colorArray["blue"]);
// draw a square
imagefilledrectangle($image,
10, 10, 50, 50, $colorMagenta);
// now allocate real color
$colorRealMagenta = imagecolorallocate($image,
255, 0, 255);
// draw a square
imagefilledrectangle($image,
30, 30, 70, 70, $colorRealMagenta);
imagegif($image);
?>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -