note 77351 added to function.imagecolorset
| From: | admin at phpgfx dot com | Date: | Sat, 25 Aug 2007 18:37:47 +0000 |
| Subject: | note 77351 added to function.imagecolorset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129783@lists.php.net to get a copy of this message | ||
Here is a function to turn an image into pure black and white
<?php
function imagepurebw( $img, $amount = 383 ) {
$total = imagecolorstotal( $img );
for ( $i = 0; $i < $total; $i++ ) {
$index = imagecolorsforindex( $img, $i );
array_pop( $index );
$color = ( array_sum( $index ) > $amount ) ? 255 : 0;
imagecolorset( $img, $i, $color, $color, $color );
}
}
?>
----
Server IP: 209.41.74.194
Probable Submitter: 172.163.53.34
----
Manual Page -- http://www.php.net/manual/en/function.imagecolorset.php
Edit -- https://master.php.net/note/edit/77351
Del: integrated -- https://master.php.net/note/delete/77351/integrated
Del: useless -- https://master.php.net/note/delete/77351/useless
Del: bad code -- https://master.php.net/note/delete/77351/bad+code
Del: spam -- https://master.php.net/note/delete/77351/spam
Del: non-english -- https://master.php.net/note/delete/77351/non-english
Del: in docs -- https://master.php.net/note/delete/77351/in+docs
Del: other reasons-- https://master.php.net/note/delete/77351
Reject -- https://master.php.net/note/reject/77351
Search -- https://master.php.net/manage/user-notes.php