copying image pixel by pixel

can someone help me as to why this cod eonly outputs a black rectangle

[code]<?php
header(“Content-type: image/jpg”);
$a = imagecreatefromjpeg(“c:C.jpg”);

$x = imagesx($a) ;
$y = imagesy($a);

$new = imagecreatetruecolor($x,$y);
imagepalettecopy($new,$a);

for ($count2 =1; $count2 >=$y;$count2++){
for ($count = 1;$count >= $x;$count++){

$pixel = imagecolorat($a,$count,$count2);
$pix = imagecolorsforindex($a,$pixel);
$color = imagecolorallocate($a,$pix[‘red’],$pix[‘green’],$pix[‘blue’]);

imagesetpixel($new,$count,$count2, $color);

}
}

imagejpeg($new);
?>[/code]
i know its messy but i was trying things to get it to work

Sponsor our Newsletter | Privacy Policy | Terms of Service