PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<imagecolorallocatealphaimagecolorclosest>
Last updated: Mon, 16 Jul 2012

imagecolorat

(PHP 3, PHP 4, PHP 5)

imagecolorat -- 取得某像素的颜色索引值

说明

int imagecolorat ( resource image, int x, int y )

返回 image 所指定的图形中指定位置像素的颜色索引值。

如果 PHP 编译时加上了 GD 库 2.0 或更高的版本并且图像是真彩色图像,则本函数以整数返回该点的 RGB 值。用移位加掩码来取得红,绿,蓝各自成分的值:

例子 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()




<imagecolorallocatealphaimagecolorclosest>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST