cohs Posted January 11, 2008 Share Posted January 11, 2008 can someone help me and tell me why this only outputs a black rectangle. <?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);?> i know its messy but i was moving things around trying to figure it out. thanks in advance Link to comment https://forums.phpfreaks.com/topic/85484-copying-image-pixel-by-pixel/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.