class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
more info about the class
if ($this->image_sephia){ $pixel = imagecolorsforindex($image_dst, imagecolorat($image_dst, $x, $y)); $rgb = imagecolorat($image_dst, $x, $y); $red = ($rgb >> 16) & 0xFF; $green = ($rgb >> 8) & 0xFF; $blue = $rgb & 0xFF; //sephia $red2 = min($red*.393 + $green*.769 + $blue*.189,255); $green2 = min($red*.349 + $green*.686 + $blue*.168,255); $blue2 = min($red*.272 + $green*.534 + $blue*.131,255); $color = imagecolorallocatealpha($image_dst, $red2, $green2, $blue2, $pixel['alpha']); imagesetpixel($image_dst, $x, $y, $color); }