note 79459 added to function.imagecolorsforindex
| From: | joe dot scylla at gmail dot com | Date: | Wed, 28 Nov 2007 14:35:53 +0000 |
| Subject: | note 79459 added to function.imagecolorsforindex | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132633@lists.php.net to get a copy of this message | ||
While it's quite easy and intuitive to get the alpha transparency of a pixel with:
<?php
$rgba = imagecolorsforindex($image, imagecolorat($image, $x, $y));
$alpha = $rgba["alpha"];
?>
you should use the return value of the command imagecolorat to get the alpha transparency with the
code below because it's much faster and will have a major impact if you process every pixel of
an image:
<?php
$rgba = imagecolorat($image, $x, $y);
$alpha = ($rgba & 0x7F000000) >> 24;
?>
----
Server IP: 217.160.72.57
Probable Submitter: 84.159.96.189
----
Manual Page -- http://www.php.net/manual/en/function.imagecolorsforindex.php
Edit -- https://master.php.net/note/edit/79459
Del: integrated -- https://master.php.net/note/delete/79459/integrated
Del: useless -- https://master.php.net/note/delete/79459/useless
Del: bad code -- https://master.php.net/note/delete/79459/bad+code
Del: spam -- https://master.php.net/note/delete/79459/spam
Del: non-english -- https://master.php.net/note/delete/79459/non-english
Del: in docs -- https://master.php.net/note/delete/79459/in+docs
Del: other reasons-- https://master.php.net/note/delete/79459
Reject -- https://master.php.net/note/reject/79459
Search -- https://master.php.net/manage/user-notes.php