I had the same problem as heavyraptor2 so i made this function...
<?php
function imagecolorize($im,$endcolor){
if (imageistruecolor($im)) {
imagetruecolortopalette($im, false, 256);
}
for ($c = 0; $c < imagecolorstotal($im); $c++) {
$col = imagecolorsforindex($im, $c);
$gray = round(0.299 * $col['red'] + 0.587 * $col['green'] + 0.114 * $col['blue']);
imagecolorset($im, $c, $gray, $gray, $gray);
}
$EndcolorRGB['r'] = hexdec( substr($endcolor, 0, 2));
$EndcolorRGB['g'] = hexdec( substr($endcolor, 2, 2));
$EndcolorRGB['b'] = hexdec( substr($endcolor, 4, 2));
$stepR = (255-$EndcolorRGB['r'])/255.0;
$stepG = (255-$EndcolorRGB['g'])/255.0;
$stepB = (255-$EndcolorRGB['b'])/255.0;
$aColor = array();
for ($i = 0; $i<=255; $i++){
$aColor[$i]['r'] = $EndcolorRGB['r'] + ($i*$stepR);
$aColor[$i]['g'] = $EndcolorRGB['g'] + ($i*$stepG);
$aColor[$i]['b'] = $EndcolorRGB['b'] + ($i*$stepB);
}
for ($c = 0; $c < imagecolorstotal($im); $c++){
$currentColorRGB = imagecolorsforindex($im, $c);
$gray = $currentColorRGB['red'];imagecolorset($im,$c,(int)$aColor[$gray]['r'], (int)$aColor[$gray]['g'], (int)$aColor[$gray]['b']);
}
}?>