This nifty function will produce the negative of a given image!
<?php
function img2neg($pic) {
header("Content-type: image/jpeg");
$source=imagecreatefromjpeg($pic); $width=imagesx($source); $height=imagesy($source);
$im = imagecreatetruecolor($width, $height); for($y=0; $y < $height; $y++) {
for($x=0; $x < $width; $x++) {
$colors=imagecolorsforindex($source, imagecolorat($source, $x,$y));
$r=255-$colors['red'];
$g=255-$colors['green'];
$b=255-$colors['blue'];
$test=imagecolorallocate($im, $r,$g,$b);
imagesetpixel($im,$x, $y, $test);
}
}
imagejpeg($im);
imagedestroy($im);
}
?>