";
$im = imagecreatefrompng("1.png");
$Pi = pi();
$centerX = $width / 2;
$centerY = $height / 2;
echo "
The picture here is " . $width . " wide, and " . $height . " tall.
";
echo "
The center of the image is at " .$centerX . ", " . $centerY ;
echo '
Test Trig Fucntions php
Get all cordinates for a circle
';
//$r = 1 ;
$sum = 0;
//echo 'Radiuz == ' . $r . '
X, Y, PixelColour at that point.
';
//Max radius
if ($centerX < $centerY){
$maxRad = $centerX - 1;
}
elseif
($centerY <= $centerX){
$maxRad = $centerY -1;
}
echo "Maximumux Radius is: " . $maxRad . "
Ring Number, Average Value:
";
for($r=1; $r<=$maxRad; $r++ ){
for ($a=0; $a<=360; $a++) {
$ax = $r*cos($a*$Pi/180) + $centerX ; //x
$ay = $r*sin($a*$Pi/180) + $centerY ; //y
$PXCol = imagecolorat($im, $ax, $ay); //outputs a decimal number for color
// echo $ax . ", " . $ay . ", " . $PXCol . "
";
$sum = $sum + $PXCol;
$avg = $sum / 360;
$trunc = round($avg);
}
echo $r . ", " . dechex($trunc) . "
";
}
// choose a color for the ellipse
$ellipseColor = imagecolorallocate($im, 0, 0, 255);
// draw the white ellipse
imagefilledellipse($im, $centerX, $centerY, 300, 300, $ellipseColor);
// Output the image.
//header("Content-type: image/png");
//imagepng($im);
//echo "
Trucated Average: ".$trunc."
";
//echo "
Average in Hex: ". dechex($trunc) ."
";
?>