PHPverse 2025

Voting

: max(two, eight)?
(Example: nine)

The Note You're Voting On

admin at phpgfx dot com
17 years ago
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 );
}
}

?>

<< Back to user notes page

To Top