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 );
}
}
?>