If you want to convert a Color image to Grayscale without creating a blotchy image, use this color calculation:<?phpfunction imagetograyscale($im){ if (imageistruecolor($im)) {imagetruecolortopalette($im, false, 256); }

I had the same problem as heavyraptor2 so i made this function...<?phpfunction imagecolorize($im,$endcolor){//funcion takes image and turns black into $endcolor, white to white and //everything in between in corresponding gradient //$endcolor should be 6 char html color

//for every color-index we now replace $gray-values for $aColorfor ($c = 0; $c < imagecolorstotal($im); $c++){$currentColorRGB = imagecolorsforindex($im, $c);$gray = $currentColorRGB['red'];//image is grayscale, so red,green and blue // should be equal. We use this number as key of aColorimagecolorset($im,$c,(int)$aColor[$gray]['r'], (int)$aColor[$gray]['g'], (int)$aColor[$gray]['b']); }}?>

I've been looking for a simple function which "colorizes" an image, without any success ... it looks like a lot of people mean something different with "colorizing" an image, because actually colorzing means multiplying the old color's grayscale with the new color. So a white pixel would become 100% of the colorize-to-color and a black pixel would stay black (I know I can't explain well ... I hope you understood, otherwise take a look at the example below the functions' code).