{% else-1 %}

                        
<?php 
$im = ImageCreateFromJpeg("file.jpg");
$size = getimagesize("file.jpg");
$new = imagecreate($size[0], $size[1]);
$black = imagecolorallocate($new, 0, 0, 0);
$white = imagecolorallocate($new, 0xFF, 0xFF, 0xFF);

for ($i = 1; $i < $size[0]; $i++) {
for ($j = 1; $j < $size[1]; $j++) {
$rgb = ImageColorAt($im, $i, $j);
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> & 0xFF;
$b = $rgb & 0xFF;
if ( $r < 128 && $r < 128 && $b < 128 ) {
imagesetpixel($new, $i, $j, $black);
} elseif ( $r >= 128 && $r >= 128 && $b >= 128 ) {
imagesetpixel($new, $i, $j, $white);
}
}
}
header("Content-type: image/jpeg");
imagejpeg($new, null, 100);
imagedestroy($im);
imagedestroy($new);
?>
3 74 0
Без комментариев...