note 54254 added to function.imagecolorclosest
| From: | MagicalTux at FF dot st | Date: | Tue, 28 Jun 2005 13:22:15 +0000 |
| Subject: | note 54254 added to function.imagecolorclosest | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91091@lists.php.net to get a copy of this message | ||
A way to get each time an answer :
<?php
function imagegetcolor($im, $r, $g, $b) {
$c=imagecolorexact($im, $r, $g, $b);
if ($c!=-1) return $c;
$c=imagecolorallocate($im, $r, $g, $b);
if ($c!=-1) return $c;
return imagecolorclosest($im, $r, $g, $b);
}
?>
If the *exact* color is found in the image, it will be returned. If we don't have the exact
color, we try to allocate it. If we can't allocate it, we return the closest color in the
image.
----
Manual Page -- http://www.php.net/manual/en/function.imagecolorclosest.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54254
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54254&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54254&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54254&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54254&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54254&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54254&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54254&report=yes
Search -- http://master.php.net/manage/user-notes.php