> 16) & 0xFF; $g = ($rgb >> 8) & 0xFF; $b = $rgb & 0xFF; $gs = (($r*0.299)+($g*0.587)+($b*0.114)); if ( $gs > 150 ) imagesetpixel($bwimage,$x,$y,$paletteWhite); else imagesetpixel($bwimage,$x,$y,$paletteBlack); } imagegif( $bwimage, $outfile ); } ?>