note 83104 added to function.imagecopymergegray
| From: | amezghal at msn dot com | Date: | Sat, 10 May 2008 00:59:41 +0000 |
| Subject: | note 83104 added to function.imagecopymergegray | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139230@lists.php.net to get a copy of this message | ||
gray effect :)
<?php
header('content-type:image/png');
$url_img = 'my_image.png';
$img = imagecreatefrompng($url_img);
$x = imagesx($img);
$y = imagesy($img);
$gray_img = imagecreatetruecolor($x, $y);
imagecolorallocate($gray_img, 0, 0, 0);
for ($i = 0; $i < $x; $i++) {
for ($j = 0; $j < $y; $j++) {
$rgb = imagecolorat($img, $i, $j);
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
//for gray mode $r = $g = $b
$color = max(array($r, $g, $b));
$gray_color = imagecolorexact($new_img, $color, $color, $color);
imagesetpixel($gray_img, $i, $j, $gray_color);
}
}
?>
----
Server IP: 217.174.223.124
Probable Submitter: 41.248.0.191
----
Manual Page -- http://www.php.net/manual/en/function.imagecopymergegray.php
Edit -- https://master.php.net/note/edit/83104
Del: integrated -- https://master.php.net/note/delete/83104/integrated
Del: useless -- https://master.php.net/note/delete/83104/useless
Del: bad code -- https://master.php.net/note/delete/83104/bad+code
Del: spam -- https://master.php.net/note/delete/83104/spam
Del: non-english -- https://master.php.net/note/delete/83104/non-english
Del: in docs -- https://master.php.net/note/delete/83104/in+docs
Del: other reasons-- https://master.php.net/note/delete/83104
Reject -- https://master.php.net/note/reject/83104
Search -- https://master.php.net/manage/user-notes.php