> 16) & 0xFF; $green = ($rgb >> 8) & 0xFF; $blue = $rgb & 0xFF; $gray = round(.299*$red + .587*$green + .114*$blue); // SHIFT GRAY LEVEL TO THE LEFT. $grayR = $gray << 16; // R: red $grayG = $gray << 8; // G: green $grayB = $gray; // B: blue // OPERATION TO COMPUTE GRAY VALUE. $grayColor = $grayR | $grayG | $grayB; // SET THE PIXEL COLOR imagesetpixel ($sourceImage, $x, $y, $grayColor); imagecolorallocate ($sourceImage, $gray, $gray, $gray); } } // COPY PIXEL VALUES TO NEW FILE BUFFER. // PLUS TRANSLUCENT RECTANGLE. $destinationImage = ImageCreateTrueColor($img_width, $img_height); imagecopy($destinationImage, $sourceImage, 0, 0, 0, 0, $img_width, $img_height); $color = imagecolorallocatealpha($destinationImage, $Rtint, $Gtint, $Btint, $transparency); imagefilledrectangle($destinationImage, 0, 0, $img_width, $img_height, $color); // CREATE FILE TO DISK OR FM. imagejpeg($destinationImage, $destinationFileName); // DESTROY TEMP IMAGE BUFFERS. imagedestroy($destinationImage); imagedestroy($sourceImage); ?>