All pastes #330265 Raw Edit

Miscellany

public text v1 · immutable
#330265 ·published 2007-01-27 19:20 UTC
rendered paste body
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;
}