copying image pixel by pixel

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

header(“Content-type: image/jpg”);
$a = imagecreatefromjpeg(“c:C.jpg”);

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

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

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);


i know its messy but i was trying things to get it to work

Sponsor our Newsletter | Privacy Policy | Terms of Service