function redeye($im){ $width=imageSX($im); $height=imageSY($im); for ($x = 0; $x < $width; $x++) { for ($y = 0; $y < $width; $y++) { $index = imagecolorat($im, $x, $y); $color = imagecolorsforindex($im, $index); $green = round(($color['green'] / 100) * 50); $blue = round(($color['blue'] / 100) * 50); $newcolor = imagecolorallocate($im, 0, $green, $blue); imagesetpixel($im,$x,$y,$newcolor); } } return $im; }